What Is a UUID? When and Why to Use One
A plain-English guide to UUIDs — what they are, why developers use them instead of simple IDs, and how to generate one instantly.
A UUID (Universally Unique Identifier), sometimes called a GUID, is a 128-bit value used to label something uniquely — like f47ac10b-58cc-4372-a567-0e02b2c3d479. The key idea: any system can generate one on its own and be confident it will never clash with a UUID generated anywhere else, without asking a central server.
What a UUID looks like
It's 32 hexadecimal characters in five groups separated by hyphens (8-4-4-4-12). The most common kind, version 4, is almost entirely random — there are so many possible values (about 3.4 x 10^38) that the chance of two colliding is effectively zero.
Why not just use 1, 2, 3…?
Auto-incrementing numbers need a single source of truth to hand out the next value. That's fine for one database, but it breaks down when many servers, devices or offline clients all need to create records at once. UUIDs solve that:
- Distributed & offline creation — any node or browser can mint an ID with zero coordination and no collisions.
- No information leak — sequential IDs reveal how many records exist and their order; UUIDs don't.
- Merge-friendly — records from different sources combine without ID conflicts.
- Harder to guess — you can't just increment a number to find the next record.
Where you'll use them
- Database primary keys (especially in distributed or multi-tenant apps).
- API idempotency / request keys to safely retry without duplicating actions.
- Correlation IDs to trace a request across microservices and logs.
- Unique file or object names, session tokens, and temporary front-end keys.
A trade-off to know: random (v4) UUIDs make less efficient database indexes than sequential keys. If that matters at scale, look at time-ordered variants like UUIDv7.
How to generate a UUID
- Open the UUID Generator — it creates a cryptographically random v4 UUID instantly.
- Generate one at a time, or produce many in bulk when you need a batch.
- Copy the result. It's all done in your browser, so nothing is sent anywhere.