TL;DR: A UUID is a 128-bit identifier that gives objects a unique name without a central authority. UUID v4, the most common version, is built from random bits, carries no creation time or machine identity, and collisions are practically impossible.
Every developer meets UUIDs early: a primary key in a database, a token in an API log, an id in a JSON response. They look like 550e8400-e29b-41d4-a716-446655440000 and they are everywhere. This explainer covers what a UUID is, how v4 works, how v1 differs, and when to use each.
What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit value defined by RFC 4122. Written as text, it appears as five hyphen-separated groups of hexadecimal digits: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. That is 32 hex characters plus four hyphens, which is why UUIDs are often stored as 16 bytes in binary but 36 characters as strings.
The point of a UUID is uniqueness without coordination. No central registry assigns IDs, and two systems can generate UUIDs independently with no practical risk of a clash. That property is what makes them useful in distributed systems.
How does UUID v4 work?
UUID v4 is the random version. Of the 128 bits, 122 come from a random source and 6 are fixed by the specification: 4 bits mark the version, shown as the digit 4 in the third group, and 2 bits mark the variant, shown as the y in the fourth group. Everything else is random, which is why v4 carries no timestamp and no information about the machine that created it.
The randomness is what makes collisions unlikely. With 2^122, about 5.3 x 10^36 possible values, reaching a 50 percent chance of a single collision requires generating roughly a billion UUIDs per second for 85 years. In practice, duplicate v4 UUIDs are not a concern.
What is the difference between UUID v1 and v4?
UUID v1 is time-based. It encodes the current timestamp plus a node identifier, often a machine's MAC address. v4 is purely random. The choice between them has real consequences:
- Sortability. v1 values are roughly time-ordered, so inserts into a B-tree database index stay compact. v4 values are random, so index writes cause more page splits and slower insert rates at scale.
- Privacy. v1 embeds the creation time and machine identity, so a v1 UUID leaks when and where a record was created. v4 carries no such metadata.
- Guessability. v4 values are harder to predict. The narrower timestamp-plus-node space of v1 is easier to enumerate.
For new systems, v4 is the default for good reason. If you need time-ordered keys, consider the newer UUID v7 rather than v1.
Two practical ways to use UUIDs
Primary keys in distributed and offline-first apps. When a mobile app creates records offline, it cannot wait for a database to assign an integer id. Client-generated UUIDs let every device mint its own key and sync later without collisions.
Identifiers that do not reveal scale. Sequential integer IDs let anyone estimate how many records a service holds. A UUID for an order or a user hides that count, and random values are far harder to enumerate.
How do you generate a UUID?
The UUID Generator produces v1 and v4 UUIDs in your browser. Pick the version, choose how many you need, from 1 to 50, and copy the results in one click. Generation runs locally, so the IDs are never sent to a server or logged.
One honest caveat: for values that must resist guessing, such as password reset tokens, use a cryptographically secure source such as the browser's crypto.randomUUID(), documented by MDN, instead of a plain random generator. For everyday keys and document IDs, the distinction rarely matters.
FAQ
Is a UUID the same as a GUID?
Yes. GUID is Microsoft's name for the same 128-bit identifier format defined by RFC 4122. The two terms are interchangeable in practice.
Can two UUIDs ever be identical?
In theory yes, because they are random. In practice, the 2^122 value space makes duplicates negligible. This is the same collision reasoning covered in the MD5 hash explainer, applied to random identifiers.
Does generating a UUID leak any information?
Only v1 does, because it embeds a timestamp and a node identifier. v4 contains no creation time or machine identity, so it is the privacy-safe default.
Is UUID v7 better than v4?
For database primary keys at scale, v7's time-ordered structure reduces index fragmentation. For general-purpose identifiers where ordering does not matter, v4 remains the standard.
Is UUID generation private?
Yes when it happens locally. The EasyToolsBox generator creates UUIDs in your browser with no network call, so no IDs are stored, tracked, or associated with you.