UUID Generator
Generate random version-4 UUIDs individually or in bulk, using cryptographic randomness — with an honest answer on collision risk.
122 random bits, not 128
A version-4 UUID looks like 128 bits of randomness and is not. Four bits are spent marking the version and two more on the variant, leaving 122 random bits — about 5.3e+36 distinct values. The six missing bits cost a factor of 64, which sounds alarming and turns out not to matter at all, for reasons the next numbers make obvious.
The honest answer is not “never”
Collisions usually get waved away as impossible. They are not impossible, only astronomically unlikely, and the distinction is worth keeping — because the birthday problem makes random collisions arrive far sooner than people expect. You do not need anything like 5.3e+36 UUIDs for trouble. You need roughly the square root of that, which is 2.7e+18 for even odds on a single collision.
That sounds enormous, and it is less enormous than it sounds. Generating a billion UUIDs every second, you would reach even odds in about 86 years — a human lifetime, not a cosmological interval. The frequently repeated claim that it would take longer than the age of the universe is wrong by a factor of roughly 2e+8.
The figure that actually matters is the risk at volumes anyone reaches, and it is reassuring for a reason you can check rather than because collisions cannot happen:
| After generating… | Chance of any collision |
|---|---|
| a million UUIDs | about 9.4e-26 |
| a billion UUIDs | about 9.4e-20 |
| a trillion UUIDs | about 9.4e-14 |
| a quintillion UUIDs | about 9.40% |
Risk grows as the square of the count, so a thousand times more UUIDs is a million times the risk — which is exactly why the square root, not the space itself, is the number to reason about. Even so, a trillion UUIDs leaves the chance of any collision at roughly one in ten trillion. Safe with enormous room to spare, and safe for a calculable reason.
How to use
- Choose how many you need.
- Generate and copy them.
- Use uppercase or hyphen options if your system expects them.
- Consider a sortable identifier if these become database keys.
Frequently asked questions
What is a version 4 UUID?
A 128-bit identifier that is random apart from a handful of bits marking the version and variant, leaving 122 random bits. The point is that anyone can generate one independently, with no central coordinator, and expect it to be unique.
Could two UUIDs ever collide?
In principle yes, in practice no. With 122 random bits, you would need to generate on the order of a billion per second for a century before the probability of any collision became meaningful. Assuming uniqueness is entirely reasonable, provided the randomness is sound.
Does the randomness matter?
Enormously, and it is the real failure mode. UUIDs generated from a weak or poorly seeded random source have collided in the wild, and predictable ones have been used to guess other users' identifiers. This tool uses the browser's cryptographic random source rather than Math.random.
Are UUIDs good database primary keys?
There is a genuine trade-off. They avoid coordination between systems and do not leak row counts, but random values scatter inserts across a B-tree index, hurting write performance and cache locality on large tables. Sequential integers behave far better as keys and reveal more.
What are UUID version 7 and ULIDs?
Time-ordered identifiers designed to solve exactly that problem — a timestamp prefix so values sort roughly by creation, with random bits after it. They keep the independence of a random identifier while restoring the index locality of a sequential one, and are usually the better modern choice for keys.
Is a UUID secret?
It should not be treated as one. A version 4 UUID is unguessable, which tempts people to use one as an access token in a URL. That works only until the link is shared, logged by a proxy, or leaked in a referrer header — genuine secrets should be revocable and expiring, and UUIDs are neither.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.