UUID Guide: Versions, Formats, and When to Use Each
2026-03-15
A UUID (Universally Unique Identifier) is a 128-bit identifier that is practically guaranteed to be unique across time and space. UUIDs look like 550e8400-e29b-41d4-a716-446655440000—five groups of hexadecimal digits separated by hyphens.
UUID Versions
| Version | Based On | Best For |
|---|---|---|
| v1 | Timestamp + MAC address | Time-ordered IDs (leaks MAC) |
| v4 | Random | Most common—general purpose IDs |
| v5 | SHA-1 of namespace + name | Deterministic IDs from known inputs |
| v7 | Unix timestamp + random | Sortable, database-friendly |
UUID vs Auto-Increment
- Security: UUIDs don't reveal record count or creation order. Auto-increment IDs like
/users/42let attackers enumerate records. - Distributed systems: UUIDs can be generated on any node without coordination. Auto-increment requires a central sequence.
- Merging databases: UUIDs don't collide when merging data from multiple sources.
- Downside: UUIDs are larger (16 bytes vs 4-8 for integers) and less readable.
Generating UUIDs
JavaScript:
crypto.randomUUID();
// "a3bb189e-8bf9-4888-9912-ace4e6543002"Python:
import uuid
str(uuid.uuid4())
# "c9bf9e57-1685-4c89-bafb-ff5af830be8a"Generate UUIDs Online
Use our Random UUID Generator to create RFC 4122 compliant v4 UUIDs instantly. Copy with one click. Need to verify a UUID? Try UUID Validator to check format and version. Browse all Generators for passwords, tokens, and more.