UUID Generator Calculator
Choose how many UUIDs to generate and their formatting.
What a UUID v4 is made of
A UUID is a 128-bit identifier written as 32 hexadecimal digits in five groups of 8-4-4-4-12. Version 4 builds it from random bits: the generator draws 16 random bytes, then pins 6 of the 128 bits — 4 version bits set to 0100 in the third group, and 2 variant bits set to 10 in the fourth — leaving 122 random bits to do the actual distinguishing. Every UUID this tool produces therefore starts its third group with a 4 and starts its fourth group with an 8, 9, a or b.
The space those 122 bits define is 2^122, or about 5.3 × 10^36 values. Written out that is a 5 followed by 36 digits — roughly one UUID for every 10^28 grains-of-sand-scale comparisons you can name. The count matters because uniqueness here is probabilistic, not guaranteed: v4 works by making collision so unlikely that no realistic system will ever see one.
How the generator builds one
The process runs in four steps. First it requests 16 random bytes from the browser’s cryptographic random source, which is unpredictable and suitable for identifiers. Second it forces the version nibble: byte 6 is masked with 0x0F and ORed with 0x40, which writes the 4. Third it forces the variant: byte 8 is masked with 0x3F and ORed with 0x80, which writes the two 10 bits. Fourth the 16 bytes are printed as 32 hex digits and sliced into the five hyphenated groups — or joined without hyphens, or uppercased, depending on the options you pick.
All three options are cosmetic. The 32 hex digits are the identifier; hyphens exist for human readability, and case is a display convention. Set the count anywhere from 1 to 50 to generate a batch, one per line, ready to paste into seed data, test fixtures or migration scripts.
Collision math: how safe is random?
The birthday paradox governs collisions. To reach a 50% chance of even one duplicate you would need to generate about 2^61 ≈ 2.3 × 10^18 UUIDs — over 2 quintillion. For a more practical benchmark: generating 103 trillion UUIDs still leaves only about a one-in-a-billion chance of a single collision. A database that creates 1,000 UUIDs every second would run for about 73 million years before approaching the 50% threshold.
What the random source means for you
These figures assume a good random source. The tool prefers crypto.getRandomValues, the browser cryptographic API, and only falls back to Math.random where that is unavailable — a weaker generator that produces perfectly valid-looking UUIDs with poorer unpredictability. For anything security-sensitive, such as session or API tokens, verify your runtime supplies the cryptographic path.
UUID versions at a glance
| Version | Source of bits | Typical use |
|---|---|---|
| v1 | Timestamp + MAC address | Legacy systems; leaks time and hardware |
| v4 | 122 random bits | General purpose; this calculator |
| v5 | SHA-1 hash of a name + namespace | Deterministic IDs for the same input |
| v7 | Timestamp prefix + random suffix | Time-sortable database keys |
Version is not a quality ranking — it is a bit layout. v4 dominates because it needs no clock, no network card and no shared namespace, works offline, and leaks nothing about when or where it was made. If your database benefits from index locality, v7’s time-ordered prefix is the modern alternative worth reading about.
Reading the hyphen layout
The five groups are not random decoration: 8-4-4-4-12 dates to the original specification, and each group has meaning — the first is called the time-low field in timestamped versions, the third opens with the version digit, the fourth with the variant bits. In v4 only the version and variant positions are meaningful; the rest is opaque randomness. Knowing the layout lets you eyeball any UUID and identify its version without parsing bits by hand.
Why systems use UUIDs at all
- No coordination: two offline servers can generate IDs forever without ever comparing notes
- No enumeration: unlike sequential integers, IDs reveal nothing about how many records exist or their order
- Safe merging: records created independently in different databases can be combined without key conflicts
- Pre-generated keys: you can know the primary key before inserting, which simplifies batch writes and event payloads
The trade-off is size and index behavior. A 128-bit UUID occupies 16 bytes raw or 36 characters as text, four times a 32-bit integer, and random keys scatter across a B-tree instead of appending. Systems that insert millions of rows per minute often choose time-ordered identifiers for exactly that reason.
Formatting notes and gotchas
Standards treat UUIDs as case-insensitive, so comparing them should ignore case — a mismatch caused by one system emitting uppercase is a display difference, not a different identifier. Without-hyphens mode outputs the compact 32-character form that some fixed-width schemas require. And a UUID is not secret: it is an identifier, not a password. Predictability is low with a cryptographic source, but the value travels in logs, URLs and databases, so access control must not rely on the UUID being hard to guess alone. When you need an unguessable credential rather than an identifier, generate one from the Password Entropy Calculator instead.
Frequently asked questions
How many random bits are in a UUID v4?
122 of the 128 bits. The other 6 are fixed: 4 version bits that make the third group start with 4, and 2 variant bits that make the fourth group start with 8, 9, a or b.
Can two generated UUIDs collide?
Practically never. You would need about 2.3 × 10^18 UUIDs for even a 50% chance of one duplicate, and generating 103 trillion still carries only roughly a one-in-a-billion risk.
What does the 4 in a UUID mean?
It is the version nibble. The digit 4 at the start of the third group marks the UUID as version 4, the random scheme. A v1 UUID would show 1 there, and a v7 shows 7.
How many UUIDs can I generate at once?
Up to 50 per run, one per line, with each drawing fresh random bytes. The count is clamped to the 1–50 range, so requesting more still yields 50.
Should I remove the hyphens from a UUID?
It is safe when a system expects the compact form. The identifier is the 32 hex digits; hyphens exist only for readability, and 8-4-4-4-12 is the standard grouping that most validators accept.
Are uppercase and lowercase UUIDs the same?
Yes. Hex digits are case-insensitive by definition, so ABCDEF... and abcdef... are one identical identifier. Normalize the case before comparing or indexing to avoid false mismatches.
Why do all generated UUIDs start their third group with 4?
Because the generator masks byte 6 with 0x0F and ORs in 0x40, forcing the version bits to 0100. The same step pins the first two bits of byte 8 to 10 for the variant, so the fourth group always starts with 8, 9, a or b.
Is a UUID v4 safe to use as a secret token?
Not on its own. With 122 cryptographic random bits it is very hard to guess, but it also travels through logs and URLs where it gets exposed. Use it as a key or identifier, and generate dedicated secrets for authentication.
Why is my UUID different every time from the same tool?
That is the design. Each generation draws 16 fresh random bytes, so no two runs match. If you need the same identifier for the same input, that is the job of a deterministic version such as v5, not v4.
Method and sources
- RFC 9562: Universally Unique IDentifiers (UUID).