What is UUID v6?
UUID version 6 is a time-based 128-bit identifier (36-char string) proposed as an improvement to UUID v1. It consists of:
- Reordered timestamp: 60-bit timestamp from most to least significant
- Clock sequence: 14-bit counter for clock adjustments
- Node ID: 48-bit value (typically MAC address)
Format example: 1eb527d6-e927-6511-9a03-0242ac130003
How UUID v6 works
- Calculate current timestamp (100ns intervals since 1582-10-15)
- Reorder timestamp bits for better sorting (most significant bits first)
- Get/increment 14-bit clock sequence (for uniqueness if clock moves backward)
- Obtain 48-bit node ID (usually from MAC address)
- Set version bits (0110) and variant bits (10)
- Assemble as 32 hex digits with hyphens: 8-4-4-4-12 format
Advantages & Considerations
Advantages | Considerations |
---|---|
|
|
UUID v6 Structure
Bits | Content |
---|---|
0-47 | High 48 bits of timestamp |
48-51 | Version (0110 for v6) |
52-59 | Low 8 bits of timestamp |
60-63 | High 4 bits of timestamp |
64-65 | Variant (10 for RFC4122) |
66-79 | Clock sequence (14 bits) |
80-127 | Node ID (48 bits) |
UUID v6 vs. other versions
Version | Based on | Use case | Privacy |
---|---|---|---|
UUID v1 | Time + MAC | Time-ordered IDs | ⚠️ Reveals MAC |
UUID v3 | Namespace + MD5 | Deterministic IDs | ✅ Private |
UUID v4 | Random | Secure random IDs | ✅ Private |
UUID v5 | Namespace + SHA-1 | Deterministic IDs | ✅ Private |
UUID v6 | Time (reordered) | Sortable IDs | ⚠️ Reveals MAC |
UUID v7 | Time + random | Sortable IDs | ✅ Private |
Common Use Cases
- Time-sortable database keys: For chronological sorting
- Distributed databases: With time-ordered indexing
- Log entries: With natural chronological order
- Audit trails: With embedded timestamps
- Message queuing: For time-based processing
- Transaction records: With chronological ordering
Frequently Asked Questions
What's the difference between UUID v1 and v6?
UUID v6 rearranges the timestamp bits from UUID v1 to make it naturally sortable in lexicographical order. The content is identical to v1, just reordered.
Is UUID v6 an official standard?
UUID v6 is currently a draft specification in the proposed RFC 4122bis document. It's not yet an official RFC standard but is implemented in many UUID libraries.
Can I extract the creation time from UUID v6?
Yes. The timestamp component can be extracted from bits 0-59 and converted back to a datetime value.
Are UUIDs v6 sortable by creation time?
Yes. Unlike v1, UUID v6 places timestamp bits in most-to-least significant order, allowing direct lexicographical (string) comparison to match chronological order.
Does UUID v6 expose my MAC address?
By default, yes. Like UUID v1, most implementations use the MAC address for the node ID. Privacy-focused implementations may use random node IDs instead.