/tutorials/what-a-uuid-actually-is
What a UUID Actually Is
Why a UUID looks the way it does, what makes a version 4 UUID different from other versions, and how unique it actually is in practice.
4 min read
Run UUID GeneratorRelated tools
The shape of a UUID
A UUID (universally unique identifier) is a 128 bit value conventionally written as 32 hex characters split into five groups by hyphens, like 3b12f1df-5232-4e59-b5a1-9a3e12f8f944. Nothing about the format ties it to a specific database, language or system; it is a plain, portable identifier that means the same thing anywhere it is used.
Why version 4 specifically is just random
UUIDs come in several versions that differ in how they are generated. Version 1 incorporates a timestamp and the generating machine's network identifier. Version 4, by far the most commonly used today, is simply 122 random bits, with a few fixed bits marking it as version 4 so a UUID can be identified as such at a glance. There is nothing to extract from a version 4 UUID beyond the value itself.
How unique 'universally unique' actually is
With 122 random bits, the odds of two randomly generated version 4 UUIDs ever colliding are astronomically small, small enough that in practice they are treated as guaranteed unique without any central coordination between whoever is generating them. This is exactly what makes UUIDs useful across distributed systems: two databases can each generate IDs independently with no realistic risk of ever assigning the same one twice.
When to reach for a UUID
UUIDs are a natural fit for database record identifiers, especially in systems where multiple services generate records independently, for temporary file names, request IDs for tracing through logs, or anywhere else a value needs to be practically guaranteed unique without checking against anything else first.
Trying it yourself
UUID Generator creates random version 4 UUIDs using your browser's own cryptographically secure random number generator. Generate a handful at once and notice the fixed version marker in the third group, the one part of the string that is never actually random.
Related tutorials
