UUID Generator

Generate RFC 4122 UUIDs (v4 random or v7 time-ordered). Batch up to 100. Cryptographically secure.


V4 vs V7: which UUID to pick

A UUID (or GUID) is a 128-bit identifier — written as 32 hex digits in 5 groups, like 550e8400-e29b-41d4-a716-446655440000. They're collision-free across systems without coordination: any process anywhere can mint one and the chance of two ever colliding is effectively zero. This tool emits RFC 4122 / RFC 9562 compliant UUIDs in v4 (random) or v7 (time-ordered) form, generated with cryptographically-secure randomness in your browser.

Where UUIDs replace auto-increment

Random (v4) vs time-ordered (v7)

Identifiers are not secrets

The ULID debate is over

For new systems in 2026, UUIDv7 (timestamp-prefixed + random tail) is almost always the right pick. It sorts in insertion order (preserving B-tree write locality), it's 128 bits (compatible with every UUID column), and the standard finally landed in RFC 9562 (May 2024). Pick v7 unless you have an explicit need for ULID's Crockford-base32 alphabet or its case-insensitivity.

Collision math, storage, and the other versions

Five v7 IDs minted in the same millisecond

Set version v7 and count 5, then generate. All five UUIDs share their leading characters — something like 0191f2c9-8a3e-7… — because they were minted inside the same millisecond and v7 puts a 48-bit timestamp at the front; they sort in creation order. Switch to v4 and the five are completely unrelated. In either version the 13th hex digit is the version nibble (4 or 7) and the 17th is the variant (always 8–b).

Primary keys, collisions, tokens, and identical prefixes

v4 or v7 for a new database primary key? v7. The timestamp prefix gives B-tree indexes write locality (recent inserts cluster on the same pages) and rows sort roughly chronologically. Reach for v4 only when you specifically want IDs with no relationship to insertion time.

Do I need to check these against my database for collisions? No. v4 carries 122 bits of entropy — you would need to generate a billion per second for decades to reach a coin-flip chance of a single clash. They're minted with crypto.getRandomValues, not Math.random, so they aren't predictable either.

Can I use a UUID as a password-reset or session token? Only if you treat it as a secret — HTTPS-only, single-use, time-limited. The format authorises nothing on its own, and a v7's leading bits reveal exactly when it was created, which is fine for an ID but poor for a secret.

Why do my v7 UUIDs look almost identical? That's the design, not a bug. The shared prefix is the millisecond timestamp; only the tail is random. Generate a batch a second apart and the prefixes advance in order.

128 bits, five groups, and a version nibble

A UUID is 128 bits written as 32 hex digits, and the version determines where those bits come from. Version 4 is almost all randomness — 122 random bits, giving collision odds so remote you can mint billions without a central authority. Version 7, newer, prefixes a Unix-millisecond timestamp before the random bits, so v7 IDs sort chronologically — a big win as database primary keys because they don't scatter writes across an index the way v4 does. Versions 1 and 5 derive from MAC-address-plus-time and from hashing a name, respectively. The version and variant digits sit at fixed positions, which is how a decoder tells them apart.

The v4 fragmentation trap

Using random v4 UUIDs as database primary keys and then wondering why insert performance degrades. Because v4 is unordered, each new row lands at a random point in the index, fragmenting it; v7 (or an ordered ULID) fixes this by embedding time. The other misconception is treating UUIDs as secret — they are unique, not unguessable in a security sense, so never rely on one alone to protect a resource.

Related

Generate secrets with the password generator instead when unguessability matters, checksum content with the hash generator, and read v7's embedded time with the timestamp converter. Which version to pick: why UUID versions matter.