Understanding UUIDs
A UUID (Universally Unique Identifier) is a 128-bit value standardized in RFC 4122 and RFC 9562. The standard format is 8-4-4-4-12 hexadecimal characters. UUIDs can be generated independently on different machines with negligible collision probability.
1. UUID Versions Explained
- Version 4 uses 122 bits of pure randomness — the most common variant in production.
- Version 7 (RFC 9562) is time-ordered, combining a millisecond timestamp with random bits for database-friendly primary keys that sort naturally by creation time.
- Versions 3 and 5 are name-based, hashing a namespace with a name using MD5 or SHA-1.
2. Collision Probability
UUID v4 has 122 bits of entropy, yielding approximately 5.3 × 10³⁶ possible values. The birthday paradox means a 50% collision chance arrives only after generating about 2.71 quintillion UUIDs — even at one million UUIDs per second, that would take over 85,000 years.
3. Common Use Cases
- Database primary keys in distributed systems where services mint their own IDs without consulting a central sequence
- Distributed system IDs for messages, events, and transactions across queues and replicas
- Public API IDs to prevent enumeration attacks — attackers cannot guess valid resource identifiers
4. UUIDs vs Auto-Increment Integers
Auto-increment integers are smaller (4–8 bytes vs 16 for UUID), faster to index, and make URLs cleaner. However, they reveal business metrics, break in sharded databases, and require a central sequence. The hybrid approach: use internal auto-increment IDs for performance, expose UUIDs externally.
5. When UUIDs Are Overkill
For single-instance applications with predictable read patterns, auto-increment IDs are simpler and faster. For small internal tools, the added complexity of UUIDs rarely pays off. Always match the identifier strategy to the system's actual requirements.
Conclusion
Done right, the whole operation takes seconds, runs entirely in your browser, and never uploads a byte of your input. For understanding UUIDs — or anywhere a precise, in-browser result beats a heavier install — this tool is the right one.