UUID & GUID Generator (v4 & v7 RFC 9562)
Generate cryptographically secure random UUID v4 and time-ordered UUID v7 identifiers in bulk. Configure uppercase, hyphens, braces, and inspect RFC 9562 bit layouts.
100% Secure & Client-Side: Generated locally using browser Web Cryptography APIs. Never transmitted to external servers.
RFC Structural Bit Inspector (First Identifier)
The Evolution of Universally Unique Identifiers: From RFC 4122 to RFC 9562
A Universally Unique Identifier (UUID), also designated as a Globally Unique Identifier (GUID) in Microsoft systems, is a standardized 128-bit label mathematically guaranteed to be unique across time and space without requiring coordination through a centralized registration authority or database lock. Formally codified by the Internet Engineering Task Force (IETF) in 2005 under RFC 4122, UUIDs have formed the backbone of distributed databases, microservice tracing tokens, and web session management.
In May 2024, the IETF ratified RFC 9562, superseding RFC 4122 and standardizing three new time-ordered formats: UUID Version 6, Version 7, and Version 8. This overhaul resolved critical architectural bottlenecks created by random UUID v4 keys in modern high-throughput relational databases.
UUID Structural Layout and 128-Bit Representation
In its canonical textual representation, a UUID is formatted as a 36-character hexadecimal string divided into five groups separated by hyphens (the 8-4-4-4-12 pattern):
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx// M represents the 4-bit version digit (e.g., 4 or 7)
// N represents the 2-to-3-bit variant (8, 9, a, or b for standard RFC Leach-Salz)
The B-Tree Index Fragmentation Problem: Why UUID v7 Was Born
For nearly two decades, UUID v4 was the default primary key choice for microservices because generating keys did not require an auto-increment sequence lock. However, when database tables grow into millions of rows, UUID v4 introduces severe performance degradation:
- Random B-Tree Page Splits: Relational databases store clustered primary key indexes as balanced trees (B+ Trees) sorted lexicographically. Because UUID v4 is uniformly random, new inserts hit random leaf pages across disk storage. When leaf pages fill up, the storage engine must split the page, rewrite neighbor pointers, and flush dirty buffers.
- Cache Eviction Thrashing: Because inserts are non-sequential, the database cannot maintain a "hot" working set in its InnoDB or PostgreSQL shared buffer pool. Every insertion forces an SSD I/O read of an unrelated index branch.
- The UUID v7 Solution: UUID v7 embeds a 48-bit millisecond Unix Epoch timestamp at the beginning of the identifier. All identifiers generated in the same millisecond share the same prefix, ensuring that new records are inserted sequentially at the rightmost leaf of the B-tree index. This restores the sequential write speed of traditional auto-increment integers while retaining global distributed uniqueness.
Comparison Matrix: UUID Version Specifications
| Specification | Primary Mechanism | Sortability | Entropy | Recommended Use Case |
|---|---|---|---|---|
| UUID v1 | 60-bit timestamp + MAC address | Poor (timestamp reversed) | Low (Hardware bound) | Legacy systems (Privacy hazard due to MAC leak) |
| UUID v3 & v5 | MD5 (v3) / SHA-1 (v5) namespace hash | None (Hash-random) | Deterministic | Deterministic entity ID generation from natural keys |
| UUID v4 | CSPRNG Random Number Generator | None (Fully random) | 122 bits | Security tokens, ephemeral session IDs, non-indexed IDs |
| UUID v7 | 48-bit Unix timestamp + 74 bits entropy | Natural Chronological Order | 74 bits | Modern Database Primary Keys (PostgreSQL, MySQL, SQLite) |
Mathematical Collision Probability Analysis
A common concern when adopting random identifiers is the theoretical probability of generating duplicate values (a hash collision). The mathematics of the Birthday Paradox governs collision frequency:
In UUID v4, 6 bits are fixed to denote the version (0100) and variant (10xx), leaving exactly 122 bits of unconstrained entropy:
N = 2^122 ≈ 5.3169 × 10^36 distinct identifiersTo achieve a mere one-in-a-billion (1 × 10-9) probability of a single collision, a distributed system would have to generate approximately 103 trillion UUIDs. Even at a generation velocity of 1 billion UUIDs per second, it would require 103,000 seconds (over 28 hours) of sustained generation to reach that infinitesimal risk threshold.