- Home
- Tools
- Generators
- UUID Generator
- UUID v4 Generator
UUID v4 Generator
Random version 4 UUIDs, made in your browser with its cryptographic random generator. One at a time or up to 1,000 in one go.
Random from start to end. The usual choice.
What is in a version 4 UUID
Chance, and almost nothing else. Of the 128 bits, 122 are random. The other six are fixed, so that software can tell what kind of UUID it is looking at.
| Bits | Where | What it holds |
|---|---|---|
| 48 | The first two groups | Random |
| 4 | The first digit of the third group | The version: always 4 |
| 12 | The rest of the third group | Random |
| 2 | Inside the first digit of the fourth group, which is therefore always 8, 9, a or b | The variant: "laid out as the standard says" |
| 62 | Everything after that | Random |
Every version 4 UUID therefore has the shape xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx. The 4 is how you recognise one.
When to choose it
Version 4 is the default choice. It contains no time, no counter and nothing about the machine that made it, so it gives nothing away and needs no coordination: any device can make one at any moment. Use it for identifiers that show up in links, for records that are made on several machines and merged later, and wherever the order of creation is nobody's business.
Where it does less well is as the primary key of a large database table. Random values land all over the index, and that slows down inserts. The version 7 page is about the alternative.
How likely is a duplicate?
| Version 4 UUIDs made | Chance that any two of them are the same |
|---|---|
| 1 million | 1 in 11 septillion |
| 1 billion | 1 in 11 quintillion |
| 1 trillion | 1 in 11 trillion |
| 2.7 quintillion: a billion every second for 86 years | 1 in 2 |
These figures follow from the 122 random bits, and they hold only when those bits really are random. Chance alone practically never produces a duplicate, so when two equal UUIDs do turn up in a system, the cause to look for is a weak random generator. The UUIDs on this page come from your browser's cryptographic generator.
The other versions, the nil UUID and the inspector are explained on the UUID generator page.