Home / Blog / What a UUID Actually Is

What a UUID Actually Is (and Why Collisions Are Not Worth Losing Sleep Over)

You have seen them in URLs, error messages and database tables: long strings of hex digits in five groups, like 3f6a2c10-9b4e-4d7a-a1c5-2e8f0b6d4913. Here is what that string is made of, and why the whole world can mint them at once without asking permission.

A number with a very large wardrobe

A UUID — Universally Unique Identifier — is, underneath the punctuation, a single 128-bit number. The familiar text form writes it as 32 hexadecimal digits split into groups of 8-4-4-4-12, separated by hyphens. The hyphens are pure typography; strip them away and the value is the same. A 128-bit number can take roughly 3.4 × 1038 different values, a figure so large that the interesting engineering question is not "can we run out?" but "can two generators accidentally pick the same one?" That question has a genuinely reassuring answer, as we will see.

The reason UUIDs exist is coordination. A traditional database hands out IDs from one counter — 1, 2, 3 — which works until two servers, two phones, or two offline laptops all need to create records at once and later merge them. UUIDs remove the traffic controller: anyone, anywhere, can mint an identifier independently, with no central registry, and trust that it does not clash with anyone else's.

The 128-bit layout

Not all 128 bits are free. A few are spent on bookkeeping, and you can read two of them right off the printed form:

Everything else is payload, and its contents depend on the version. Older version 1 UUIDs embed the time of creation and a hardware address, which makes them roughly sortable but leaks information about when and where they were made. Version 4, the kind almost every modern generator produces — including ours — skips all of that.

Version 4: randomness, and nothing else

A version 4 UUID fills its payload with random bits: 122 of the 128 bits are chosen at random, with the remaining 6 reserved for the version and variant markers. Good generators draw those bits from the operating system's cryptographic random source — the same well browsers and security software use — so each value is unpredictable as well as unique. There is no timestamp to decode, no machine address to trace, and no sequence to guess. One UUID tells you nothing whatsoever about the next.

The collision odds, in plain terms

Because the bits are random, collisions are a probability question, and probability has a famous shortcut: the birthday effect. Matches become likely far sooner than intuition suggests — but "far sooner" still leaves absurd amounts of room when the space has 2122 slots. To have even a 50% chance of one collision somewhere, you would need to generate around 2.7 quintillion UUIDs — 2.7 billion billion. Put practical numbers against it: mint a billion UUIDs every second, without pause, and after a full century your chance of a single duplicate would still be far below one in a billion billion. If a collision is discovered in ordinary software, the honest explanation is almost always a broken random number generator, not bad luck.

Where UUIDs earn their keep

Database records created on devices that sync later. Order numbers, session tokens and file names that must never collide on a shared disk. Log correlation IDs that let one request be followed across a dozen services. Anywhere that two systems create names independently and meet afterwards, a UUID is usually doing quiet work underneath.

Common misconceptions

Try it: generate a batch with the UUID Generator and look for the 4 starting the third group and the 8, 9, a or b starting the fourth — the two fingerprints this article described, visible in every result.