Generate UUID v4
A 128-bit identifier that is almost entirely random — 122 bits come straight from the CSPRNG, with only the 4-bit version and 2-bit variant fields fixed. The default choice when you want a random, unguessable ID.
Generated · 0 IDs
Options
This ID
Collision
This is a whole-set estimate, not a per-ID chance. UUID v4 has no timestamp or counter, so every generated ID shares the same random space.
Validate and parse UUID v4
Paste an ID
About UUID v4
Use when: you need a random, unguessable ID and ordering does not matter — request IDs, idempotency keys, file names.
Avoid when: you want IDs that sort by creation time (use UUID v7 or ULID) or shorter URLs (use NanoID).
How it is generated
A v4 UUID is mostly raw randomness. You take 16 bytes from a CSPRNG, then overwrite six bits to mark the version and the RFC 9562 variant. Everything else — all 122 remaining bits — is random.
No timestamp, no node, no counter. Two v4 UUIDs minted a microsecond apart look nothing like each other; that’s the whole point.
- 01 Read 16 bytes from crypto.getRandomValues.
- 02 Set the high nibble of byte 6 to 0100 (version 4).
- 03 Set the top two bits of byte 8 to 10 (variant). Leave the remaining 122 bits alone.
- 04 Hex-encode with dashes after bytes 4, 6, 8, 10.
xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx └──┬───┘ └─┬┘ │└┬┘ │└┬┘ └────┬─────┘ │ │ │ │ │ │ └── 48 random bits (bytes 10..15) │ │ │ │ │ └────────── 12 random bits (low 12 of bytes 8..9) │ │ │ │ └──────────── variant "10" (top 2 bits of byte 8) │ │ │ └─────────────── 12 random bits (low 12 of bytes 6..7) │ │ └───────────────── version "4" (top nibble of byte 6) │ └──────────────────── 16 random bits (bytes 4..5) └────────────────────────── 32 random bits (bytes 0..3) Total: 122 random bits + 6 fixed bits (4 version + 2 variant).
All of this runs in your browser. Random bytes come from crypto.getRandomValues, timestamps come from the system clock, and nothing about the generated ID leaves the tab.