UUID Generator
How to use this UUID generator
- A random UUID is generated automatically when the page loads.
- Click "Generate New" for another one anytime.
- Click the value to select it, then copy.
What is a UUID?
A Universally Unique Identifier is a 128-bit value used to identify information without a central authority. Version 4 UUIDs are generated using random numbers, with a collision probability low enough to treat them as unique.
Where are UUIDs used?
Database primary keys, distributed systems, session tokens, and file names are common uses where you need a unique ID without coordinating with a central server.
How likely is a UUID collision?
Astronomically unlikely — you'd need to generate trillions of UUIDs per second for billions of years before a collision became a meaningful risk.
What's the difference between v4 and other UUID versions?
Version 4 is purely random, while other versions incorporate timestamps or hardware identifiers (v1) or hash-based values (v3/v5) instead — v4 is the most commonly used today.
The structure hidden inside every UUID
A UUID's familiar 8-4-4-4-12 hexadecimal format isn't just for readability — a few of those digits carry real structural meaning. The first digit of the third group always identifies the UUID's version (a "4" there means version 4, the random kind this tool generates), and the first one to two bits of the fourth group identify the variant, which specifies which layout rules the rest of the UUID follows (the vast majority of UUIDs in use today use variant 1, the RFC 4122 layout). For a version 4 UUID specifically, every other bit besides these fixed version and variant markers — 122 bits in total — is filled with random data, which is where its practical uniqueness actually comes from.
The actual math behind "collisions are astronomically unlikely"
The claim that UUID collisions are practically impossible isn't just reassurance — it's a specific, calculable consequence of the birthday paradox applied to a 122-bit random space. With 122 random bits, there are roughly 5.3 x 10^36 possible version 4 UUIDs. The birthday paradox math says you'd need to generate around the square root of that number — about 2.71 x 10^18 UUIDs — before a 50% chance of any collision at all appears. To put that in perspective, generating a billion UUIDs per second continuously would still take over 85 years to reach that halfway point, which is why treating a generated UUID as globally unique without checking is standard, well-founded practice rather than an approximation being glossed over.
Why there are multiple UUID versions, and what changed with v7
UUID isn't a single fixed algorithm — the version number reflects genuinely different generation strategies suited to different needs. Version 1 embeds the generating machine's timestamp and MAC address, making it sortable by creation time but at the cost of leaking hardware identity. Versions 3 and 5 are deterministic, generated by hashing a namespace and a name (MD5 for v3, SHA-1 for v5), so the same input always produces the same UUID — useful when you need a stable, repeatable ID derived from existing data rather than a random one. Version 4, purely random, remains the most broadly used today because it needs no coordination or identifying input at all. A newer version, v7, has gained adoption specifically for database primary keys because it combines a timestamp prefix with random bits — sortable like v1, without leaking hardware information like v1 does.
UUIDs versus auto-incrementing integers as database primary keys
Choosing between UUIDs and simple auto-incrementing integers as primary keys is a genuinely consequential database design decision, not a stylistic preference. UUIDs can be generated anywhere — client-side, in a distributed microservice, offline — without coordinating with a central database to reserve the next available number, which makes them well suited to distributed systems and to merging data from multiple sources without ID collisions. Auto-incrementing integers require that central coordination but are smaller, and their strictly sequential order tends to keep database index insertion performance better, since new rows are appended at the end of the index rather than scattered randomly throughout it the way random UUIDs are inserted — a real, measurable performance difference at large scale that's driving some of the interest in timestamp-prefixed alternatives like UUIDv7 mentioned above.
Limitations of this tool
This tool generates version 4 (random) UUIDs using your browser's built-in cryptographically secure random number generator — it doesn't generate other UUID versions like v1 (timestamp-based), v3/v5 (name-based, deterministic hashes), or the newer v7 (timestamp-prefixed, sortable), each of which serves a different purpose described above. It also doesn't validate or parse an existing UUID you already have to check its version or extract its embedded data. If your use case specifically needs a sortable or deterministic identifier rather than a purely random one, a UUID version other than v4 is likely the better fit.