UUID generator (v4 & v7)

Generate one or up to 1,000 UUIDs. Version 4 is fully random; version 7 starts with a millisecond timestamp so IDs sort by creation time.

UUID format

A UUID is 128 bits written as 32 hex digits in groups 8-4-4-4-12, e.g. 550e8400-e29b-41d4-a716-446655440000. The first digit of the third group is the version; the first digit of the fourth group (8, 9, a or b) marks the RFC 9562 variant.

VersionBuilt fromUse
v1Timestamp + MAC addressLegacy; leaks the machine address
v4122 random bitsGeneral-purpose IDs
v5SHA-1 of namespace + nameDeterministic IDs
v748-bit Unix ms + 74 random bitsDatabase primary keys (index-friendly)

Collision odds

With 122 random bits, you would need to generate about 2.7 × 1018 v4 UUIDs to reach a 50% chance of a single duplicate (birthday bound: √(2122) × 1.18).

Why v7 for databases?

Random v4 keys land all over a B-tree index, causing page splits. v7 keys increase over time, so inserts append near the end of the index, similar to an auto-increment integer.

Frequently asked questions

Is a GUID the same as a UUID?
Yes. GUID is Microsoft's name for the same 128-bit format.
Are these UUIDs secure tokens?
v4 values come from the cryptographic RNG and are unguessable, but a dedicated random secret from the secret generator is clearer for tokens.