The Version Library

A complete reference of all UUID versions defined in RFC 4122 and RFC 9562.

Version 4: Pure Randomness

Standard

The workhorse of the web. Generated using 122 bits of cryptographically strong pseudo-random numbers (CSPRNG).

Bit Layout
Fixed (6 bits):Ver 4 (0100)Var 1 (10)
Random (122 bits):Random Data ARandom Data B
Total: 128 Bits

👍 Pros

Simple to implement. High privacy (no data leakage). No coordination required. Collisions are statistically impossible (< 1 in 10^36).

👎 Cons

Not sortable (Unordered). Causes "Page Splitting" and Index Fragmentation in B-Tree databases.

Version 7: Unix Epoch Time

Recommended

The new gold standard for databases (RFC 9562). Combines a 48-bit Unix timestamp (milliseconds) with 74 random bits. Sortable and unique.

Bit Layout
Timestamp (48 bits)
Unix Epoch (ms)
Ver + Random A (16 bits)
Ver 7 (0111) + 12 bits rand
Var + Random B (64 bits)
Var 1 (10) + 62 bits rand
Sortable Component: Bits 0-47 (Time)

👍 Pros

Sortable (Monotonic). Database Index Friendly (Sequential inserts). High Entropy. No MAC address required.

👎 Cons

Reveals creation time (to the millisecond).

Version 6: Reordered Time

Transitional

A field-compatible update to v1. Reorders timestamp bytes so "High" time comes first for sorting.

Bit Layout
Bits 0-31: Time Low
Bits 32-47: Time Mid
Bits 48-63: Ver (1) + Time High
Bits 64-79: Var (10) + Clock Seq
Bits 80-127: Node ID (MAC Address)

👍 Pros

Sortable by creation time. Compatible with v1 fields.

👎 Cons

Superseded by v7. Still uses MAC address (privacy).

Version 8: Custom Vendor

Specialized

A standardized bucket for "non-standard" implementations. Allows embedding custom data while valid.

Bit Layout
Bits 0-31: Time Low
Bits 32-47: Time Mid
Bits 48-63: Ver (1) + Time High
Bits 64-79: Var (10) + Clock Seq
Bits 80-127: Node ID (MAC Address)

👍 Pros

Maximum flexibility. Valid UUID format.

👎 Cons

No interoperability guarantees.

Version 1: Gregorian Time & MAC

Legacy

Version 1 concatenates a 60-bit timestamp (100ns intervals since 1582) with the generating node's 48-bit MAC address.

Bit Layout
Bits 0-31: Time Low
Bits 32-47: Time Mid
Bits 48-63: Ver (1) + Time High
Bits 64-79: Var (10) + Clock Seq
Bits 80-127: Node ID (MAC Address)

👍 Pros

Guaranteed unique per machine. Roughly time-ordered.

👎 Cons

Privacy Nightmare: Encodes the creator's MAC address. Relies on stable system clock. Middle-endian timestamp makes sorting hard.

Version 3: MD5 Name-Based

Legacy

Generated by hashing a "Namespace UUID" and a "Name" string using MD5. Deterministic: same input = same UUID.

Bit Layout
Bits 0-31: Time Low
Bits 32-47: Time Mid
Bits 48-63: Ver (1) + Time High
Bits 64-79: Var (10) + Clock Seq
Bits 80-127: Node ID (MAC Address)

👍 Pros

Deterministic. Good for mapping external IDs to UUIDs.

👎 Cons

MD5 is cryptographically broken (collision attacks exist). Slower than random.

Version 5: SHA-1 Name-Based

Standard

Identical to v3 but uses SHA-1 hashing. The preferred method for deterministic UUIDs.

Bit Layout
Bits 0-31: Time Low
Bits 32-47: Time Mid
Bits 48-63: Ver (1) + Time High
Bits 64-79: Var (10) + Clock Seq
Bits 80-127: Node ID (MAC Address)

👍 Pros

Stronger hash than MD5. Deterministic mapping.

👎 Cons

Slower than v4. SHA-1 is theoretically weak (but fine for uniqueness).

Version 2: DCE Security

Obsolete

Replaces low timestamp with POSIX UID/GID. Defined in DCE 1.1.

Bit Layout
Bits 0-31: Time Low
Bits 32-47: Time Mid
Bits 48-63: Ver (1) + Time High
Bits 64-79: Var (10) + Clock Seq
Bits 80-127: Node ID (MAC Address)

👍 Pros

Includes POSIX user identity.

👎 Cons

Limited randomness. Violates opacity. Not in original RFC 4122.