What Is a UUID? Version 4, Explained Simply
Updated: 29 August 2026
A UUID — universally unique identifier — is a 128-bit label that looks like 3f9a2c81-7e4d-4b6a-9c1f-2d8e5a70b431: 32 hexadecimal characters in a 8-4-4-4-12 pattern. Its job is to be unique across every machine on Earth without anyone coordinating anything.
Uniqueness without a registry
Normally, guaranteeing "no two IDs are ever the same" needs a central authority handing numbers out in order. UUIDs take the opposite approach: make the space of possible IDs so astronomically vast that two independently generated IDs simply never coincide in practice. Any device can mint one at any moment, offline, with no server and no coordination — which is exactly why distributed systems love them.
What "version 4" means
Several UUID versions exist; version 4 is the one you'll meet most. Of its 128 bits, six are fixed — they encode the version (that's why the third group always starts with a 4) and the variant (why the fourth group starts with 8, 9, a or b). The remaining 122 bits are pure randomness, drawn from the generator's random source. Older version 1 UUIDs embedded a timestamp and the machine's network address, which leaked information about where and when they were made; v4 carries no such fingerprint.
Can two UUIDs collide?
In theory, yes. In practice, no. There are 2122 ≈ 5.3 × 1036 possible v4 UUIDs. Generating a billion UUIDs every second, you'd still expect to wait close to a century before reaching even a 50% chance of a single collision anywhere in the batch. That's the birthday-problem maths behind the confident claim that v4 UUIDs "just don't collide".
Where UUIDs are used
- Database primary keys that must be generated on many machines at once.
- Order numbers, request IDs and correlation IDs in logs and APIs.
- Uploaded-file names that must never clash.
Where a UUID is the wrong tool
Not as a password or a secret token. A v4 UUID generated from a cryptographic random source contains plenty of randomness, but UUIDs habitually end up in URLs, logs and error reports where they're treated as public — secrets deserve a value nobody prints (see the Password Generator). And v4 UUIDs don't sort by creation time; if you need time-ordered IDs, that's a different tool.
Need one — or a hundred? The UUID Generator creates version 4 UUIDs using your browser's cryptographic random number generator, entirely on your device.