Skip to main content

Generate unique UUID v4 identifiers.

All calculations performed locally in your browser. No data sent to server.

Results are for informational purposes. Verify results with other sources.

UUIDs: what the digits mean

A UUID is a 128-bit identifier written as 32 hex digits in a 8-4-4-4-12 pattern. Version 4 — the kind this tool generates — fills almost all of those bits with random data, so two independently generated values are, for practical purposes, never the same.

How it works

  • Generates 128 bits, then overwrites six of them: four to record the version (4) and two to record the variant.
  • That leaves 122 bits of actual randomness, which is where the collision resistance comes from.
  • Formats the result as 8-4-4-4-12 hexadecimal characters separated by hyphens.
  • Uses the browser's crypto.getRandomValues, a cryptographically secure source — not Math.random.
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
                 ↑    ↑
            version  variant (8, 9, a or b)

random bits = 128 − 6 = 122

Worked example

Reading a real v4 UUID position by position.

  1. f47ac10b-58cc-4372-a567-0e02b2c3d479
  2. position 15 (start of the third group) is 4 → version 4, randomly generated
  3. position 20 (start of the fourth group) is a → the RFC 4122 variant
  4. the other 122 bits are random
  5. collision odds: after 1 billion UUIDs, roughly 1 in 10^22

You would need to generate about 2.7 × 10^18 UUIDs before reaching a 50% chance of a single collision — a number large enough that duplicates are a bug in your code, not bad luck.

Reading the result

  • Version 4 UUIDs do not sort. Inserting them as a primary key scatters writes across a B-tree index, which fragments the index and slows inserts on large tables. Version 7, which puts a timestamp in the high bits, was designed for exactly this and sorts chronologically.
  • A UUID is an identifier, not a secret. It is unguessable in practice, but treating one as an access token means anyone who sees it in a URL, a log or a referrer header holds the key.
  • Store them as a 16-byte binary or a native uuid column, not as a 36-character string. The text form more than doubles the storage and slows every comparison.
  • Case is not significant and hyphens are formatting. Compare canonically or you will get false mismatches between systems.

Common questions

What are the real odds of a collision?
With 122 random bits, generating a billion UUIDs per second for a century leaves the probability of any collision negligible. In practice every duplicate UUID that gets reported turns out to be a seeded or reused generator, not a genuine collision.
Should I use v4 or v7 for database keys?
v7 for anything you insert at volume, because it sorts by creation time and keeps index writes sequential. v4 remains the right choice when you specifically do not want the identifier to leak when it was created.