UUID Generator
Generate random UUIDs, with the bit count stated correctly.
How many — 5
How this works
Sixteen random bytes are drawn from crypto.getRandomValues, then six bits are overwritten as the specification requires — four to mark version 4 and two to mark the variant — and the result is formatted in the usual hyphenated hex. That leaves 122 random bits rather than 128, which is the figure reported here. It changes nothing practically: even at 122 bits you would need to generate on the order of a billion UUIDs a second for decades before a collision became likely. It is stated because the difference between the number people quote and the number that exists is exactly the kind of small overstatement worth not repeating.
What the results mean
- Version 4
- Random, as opposed to time or name based. The usual choice for identifiers.
- Random bits
- 122, not 128. Six bits are fixed by the specification.
- Randomness source
- crypto.getRandomValues, the platform cryptographic generator.
- Collision risk
- Negligible at any realistic rate, even at 122 bits.
Common problems and fixes
- Can I use a UUID as a secret?
- Not really. It is unguessable in practice but was not designed as a security token, and systems that treat one as an unguessable capability tend to leak them in logs and URLs.
- I need UUIDs without hyphens
- Turn the hyphen option off. The hyphens are formatting rather than data.
- Are these guaranteed unique?
- Not guaranteed, but the probability of collision is negligible at any rate a real system generates them.
Frequently asked questions
Why 122 bits rather than 128?
Four bits are fixed to indicate version 4 and two to indicate the variant, leaving 122 free. The distinction rarely matters in practice but the 128 figure is repeated so often it is worth correcting.
What is the chance of a collision?
Vanishingly small. You would need to generate roughly a billion a second for decades before it became likely, which is why UUIDs are used without coordination.
Is version 4 the right choice?
For most identifiers yes. Version 7 is worth considering where you want time-ordered identifiers for database locality, since random UUIDs scatter across an index.
Put this on your own site
Free to embed, no attribution required beyond the source link the frame carries itself. It runs entirely in your visitor's browser, sets no cookies and loads no third-party script.
<iframe src="https://runthetests.com/embed/uuid-generator/" width="100%" height="560" style="border:1px solid #e5e5e5;border-radius:8px" title="UUID Generator" loading="lazy"></iframe>
Preview it at https://runthetests.com/embed/uuid-generator/. Embedded pages are marked noindex, so yours stays the canonical copy — not this one.
More in DevTools
- Arduino / ESP Board DetectorIdentify a board from its USB IDs — and be told plainly when only the bridge chip is known.
- ASCII Table ReferenceLook up any character’s ASCII code in every base.
- .htaccess Rule GeneratorDescribe the rules you want and get a valid .htaccess block.
- HTML Entity Encoder / DecoderEncode or decode HTML entities, whichever the text needs.
- HTML to MarkdownTurn a page of HTML into readable Markdown.
- JSON Compare / DiffDiff two JSON documents structurally instead of by text.