A UUID (Universally Unique Identifier) is a 128-bit label formatted as xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx — 32 hexadecimal digits in five groups. The design goal is that any two independently generated UUIDs will be unique across all space and time, without coordination between systems.
| Version | Based on | Use when |
|---|---|---|
| v1 | MAC address + timestamp | Sortable by creation time; exposes MAC address (avoid in security-sensitive contexts) |
| v3 | MD5 hash of namespace + name | Deterministic ID from a known name (e.g. URL → UUID); reproducible |
| v4 | Random | Most common. Fully random, no structure, suitable for anything requiring uniqueness without ordering |
| v5 | SHA-1 hash of namespace + name | Like v3 but SHA-1; deterministic and reproducible |
| v7 | Unix timestamp + random | Newer standard: sortable like v1, but based on Unix time with no MAC leak — preferred for DB primary keys |
Using UUIDs (v4) as primary keys is common in distributed systems because IDs can be generated client-side without a round trip to the database — no auto-increment race condition. The tradeoff: random UUIDs cause index fragmentation in B-tree indexes (especially MySQL/InnoDB) because new rows don't land at the end of the index. Solutions:
BINARY(16) not VARCHAR(36) to save space and improve index performance. A v4 UUID has 122 bits of randomness (6 bits are fixed for version/variant). That means there are 2¹²² ≈ 5 × 10³⁶ possible values. If you generated 1 billion UUIDs per second for the entire age of the universe, the probability of a collision would still be essentially zero. This generator uses crypto.randomUUID() — the browser's CSPRNG — not Math.random().
Generated entirely in your browser. Nothing is sent to any server.