How UUID v4 / GUID Generation, 122-Bit Entropy & Database Keys Work
Why Distributed Systems Use UUIDs Instead of Auto-Incrementing Integers
A Universally Unique Identifier (UUID)—also known as a GUID (Globally Unique Identifier) in Microsoft ecosystems—is a 128-bit identifier formatted as 32 hexadecimal digits split into five hyphen-delimited groups (8-4-4-4-12). Unlike traditional auto-incrementing SQL integers (1, 2, 3...), which expose total record counts in public URLs and collide when merging records across microservices or offline mobile apps, UUID Version 4 lets any client or server generate globally unique primary keys independently without coordinating with a central database sequence. Our generator uses the browser's hardware-backed Web Crypto API (crypto.getRandomValues) rather than predictable pseudo-random math functions.
How to Generate & Validate UUIDs in 3 Easy Steps
- Copy a Single UUID or Generate in Bulk: Click Copy UUID at the top for an immediate ID, or enter any count from
1 to 100 and click Generate Bulk UUIDs.
- Customize String Formatting: Toggle UPPERCASE, No Hyphens (compact 32-character hex), or Wrap in { } for Windows Registry / .NET GUIDs.
- Validate Existing IDs: Paste any UUID into the Instant UUID / GUID Validator at the bottom of the card to verify its RFC version and variant bits.
UUID v4 Entropy Bits & Collision Probability Formula + Worked Example
Out of 128 total bits in a Version 4 UUID, 4 bits specify version 4 and 2 bits specify the RFC variant (8, 9, a, or b), leaving 122 cryptographically random bits:
Total Possible UUID v4 Keys = 2122 ≈ 5.3 × 1036 | Collision Risk ≈ n² / (2 × 2122)
Worked Example: Inspecting the UUID structure xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx:
The 13th hex digit is always fixed to 4 (identifying Version 4 random), and the 17th hex digit y is always 8, 9, a, or b.
Even if your application generates 1 billion UUIDs every second for 85 years (2.68 × 1018 IDs), the probability of a single duplicate collision remains below 50%.
UUID Versions (v1–v8), Bit Layout & Database Storage Reference (16 Specs)
Use this technical developer reference table to compare RFC 9562 UUID versions, string lengths, and SQL/NoSQL storage footprints.
| UUID Version / Format |
Generation Mechanism |
Sortability / Ordering |
Best Engineering Use Case |
| UUID v1 |
Gregorian Timestamp + MAC Address |
Time-ordered |
Legacy distributed logs (exposes hardware MAC) |
| UUID v3 |
Namespace + Name (MD5 Hash) |
Deterministic |
Reproducible IDs from URLs/domains (legacy) |
| UUID v4 (Most Popular) |
122-Bit CSPRNG Random |
Random |
REST APIs, session tokens, public resource IDs |
| UUID v5 |
Namespace + Name (SHA-1 Hash) |
Deterministic |
Generating identical UUIDs from identical inputs |
| UUID v6 |
Reordered Gregorian Timestamp |
DB Index-Friendly |
Migrating v1 systems to B-tree friendly indexes |
| UUID v7 (Modern DB Standard) |
Unix Epoch ms + Random |
Monotonic Time-Sorted |
High-write PostgreSQL & MySQL primary keys |
| UUID v8 |
Custom Vendor-Specific Bits |
Custom |
Specialized internal telemetry & sharding |
| Nil UUID |
00000000-0000-0000-0000-000000000000 |
All Zeros |
Sentinel / uninitialized placeholder value |
| Max / Omni UUID |
ffffffff-ffff-ffff-ffff-ffffffffffff |
All Ones |
Upper-bound range query sentinel |
| Standard Hyphenated String |
8-4-4-4-12 format |
36 Characters |
JSON APIs, URLs, human-readable logs |
| Compact Hex String (No Hyphens) |
32 continuous hex digits |
32 Characters |
Compact tokens, filenames, CHAR(32) columns |
| Microsoft Registry / .NET GUID |
Wrapped in curly braces {...} |
38 Characters |
Windows COM, C#, and Registry keys |
PostgreSQL Native uuid Type |
Binary 128-bit storage |
16 Bytes |
Fastest indexing & smallest disk footprint |
MySQL 8.0 UUID_TO_BIN() |
BINARY(16) column |
16 Bytes |
Avoids 36-byte VARCHAR(36) index bloat |
| MongoDB Binary UUID (Subtype 4) |
BSON Binary 128-bit |
16 Bytes |
Cross-language document identifiers |
| Web Crypto API Security |
crypto.getRandomValues() |
OS Entropy Pool |
Cryptographically unpredictable in all browsers |
Generating strong passwords, formatting JSON payloads, encoding Base64 strings, or escaping URLs? Explore our companion developer tools: