Random UUID v4 generator
This tool mints random version-4 UUIDs — 128-bit identifiers (defined by RFC 4122) used as primary keys, request IDs, idempotency tokens, and public-facing resource IDs. Because there is no central registry, anyone can generate one offline and the odds of a collision are vanishingly small. Generate one or up to a thousand at once.
How it works
The generator fills a 16-byte array with crypto.getRandomValues — the browser’s cryptographically secure random source, not the weaker Math.random. It then sets the version nibble to 4 (byte 6) and the variant bits (byte 8) exactly as RFC 4122 requires, and renders the bytes as lowercase hex grouped 8-4-4-4-12. Optional toggles uppercase the output or wrap each value in { } braces for use in .NET or C# contexts where GUIDs are typically written as {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.
UUID v4 anatomy
A generated UUID v4 looks like:
3f50b2a1-9c7d-4e2f-8b41-6a2c9d0f1e73
| Position | Hex digits | Meaning |
|---|---|---|
| Group 1 (8 hex) | 3f50b2a1 | 32 random bits |
| Group 2 (4 hex) | 9c7d | 16 random bits |
| Group 3 (4 hex) | 4e2f | 4 = version 4; remaining 12 bits random |
| Group 4 (4 hex) | 8b41 | 8 = RFC 4122 variant; remaining 12 bits random |
| Group 5 (12 hex) | 6a2c9d0f1e73 | 48 random bits |
The 4 at the start of group 3 and the 8, 9, a, or b at the start of group 4 are the only fixed values — everything else is random. Total random content: 122 bits.
When UUID v4 is the right choice
UUID v4 is the most widely used UUID version because it requires nothing but a good random source. Choose it when:
- You need globally unique identifiers without any server coordination or central authority.
- The IDs are exposed in URLs, APIs, or user-facing contexts where you do not want to reveal creation order or sequence.
- You are working with systems that specifically expect RFC 4122 format (PostgreSQL’s native
uuidtype, most ORMs, REST frameworks).
Consider UUID v7 if you need the identifiers to sort chronologically — v7 embeds a millisecond timestamp in the leading bits so IDs created later always sort after earlier ones. This is valuable for database primary keys because time-ordered keys insert at the end of a B-tree index rather than scattering across it.
UUID v4 versus GUID — the same thing
GUID (Globally Unique Identifier) is Microsoft’s term for a UUID. The format, bit layout, and collision properties are identical. A UUID v4 generated here is a valid GUID. The only practical difference is that Windows tools and .NET often display GUIDs wrapped in braces ({...}), which is why this generator has an optional brace toggle.
Collision probability — why no registry is needed
With 122 random bits, the probability that any two generated UUIDs are the same is about 1 in 5.3 × 10^36. Even generating one billion UUIDs per second for 100 years would produce a collision probability below 1 in 10^12. In practice, UUID v4 is treated as collision-free for all real-world applications. No central registry, database check, or coordination between generators is needed.
Notes
Everything runs in your browser — nothing is uploaded. The cryptographic random source (crypto.getRandomValues) is seeded by the operating system, not by Math.random, so the randomness is suitable for security-sensitive contexts such as session tokens and idempotency keys.