nex9.de

What Is a UUID (and When Should You Use One)?

A Universally Unique Identifier, or UUID, is a 128-bit value used to identify information without needing a central authority to hand out IDs. Here's what that means in practice.

Ad space

What a UUID actually looks like

A UUID is normally written as 32 hexadecimal digits split into five groups, like 3fa85f64-5717-4562-b3fc-2c963f66afa6. That's 36 characters including the hyphens. Under the hood it's just a 128-bit number — the hyphens and hex formatting are purely for readability.

Why not just use 1, 2, 3…?

Auto-incrementing integers are simple and compact, but they only work cleanly when a single database is handing out the numbers. The moment you have multiple services, offline clients, or merging datasets, two different systems can independently assign the same integer ID to different records. UUIDs solve this by making it astronomically unlikely that any two systems, anywhere, ever generate the same value — without those systems needing to talk to each other first.

How unlikely is a collision, really?

The most common variant, UUID version 4, is generated almost entirely from random bits (122 random bits, with 6 fixed bits marking the version and variant). To get a 50% chance of a single collision, you'd need to generate roughly 2.7 quintillion UUIDs. For context, if every person on Earth generated a billion UUIDs, the odds of any collision would still be effectively zero. That's why UUID v4 is trusted as a practical stand-in for "guaranteed unique" in most applications.

Common use cases

When a UUID is the wrong choice

UUIDs are 4x larger than a 32-bit integer and don't sort meaningfully by creation time (v4 is fully random), which can hurt index performance on very large, high-write database tables. If you need ordering, consider a UUID variant designed for it (like UUIDv7, which embeds a timestamp) or a different ID scheme such as Snowflake IDs. For small to medium applications, this rarely matters in practice.

Try it

You can generate real UUID v4 values, in bulk, with our free UUID generator — it uses your browser's cryptographically secure random number generator and never sends anything to a server.