How UUID v4 Generation Works
Generate one or more random version-4 UUIDs using browser cryptography. Copy the list in your preferred case. UUIDs are identifiers; do not assume that an unguessable-looking identifier replaces authorization or a secret token.
UUID vs GUID
GUID and UUID commonly refer to the same 128-bit identifier format in everyday software workflows. A GUID generator can therefore produce UUID v4 strings, but application storage and byte-order conventions can differ.
UUID Format and Version Bits
A UUID string uses five hyphen-separated hex groups. Version and variant bits constrain part of the random value. Keep the full identifier and validate its format rather than checking only its length.
Bulk UUID Generation
Set the quantity, generate a batch and copy the results. Store identifiers with a uniqueness constraint where collisions would matter. Avoid shortening UUIDs unless you have analyzed the smaller identifier space.
When to Use UUIDs
UUIDs help create identifiers independently without a central counter. Version 4 does not encode chronological ordering. For databases, consider indexing and storage requirements in addition to uniqueness.
More examples and technical details
What Is a UUID?
A UUID is a Universally Unique Identifier: a 128-bit value designed so that anyone, anywhere, can mint one without asking a central authority for permission and still be confident nobody else will produce the same value. Written out in the canonical form it is 36 characters long, made of 32 hexadecimal digits split by four hyphens into groups of 8, 4, 4, 4, and 12.
Microsoft calls the same structure a GUID (Globally Unique Identifier). The layout, the length, and the guarantees are identical, so a value produced here drops straight into any system expecting either name.
UUID Versions Compared
The specification defines several versions, and they differ in where the bits come from. Some are derived from time, some from hashing a name, and some are simply random. The version digit is stored inside the value itself, so any UUID tells you how it was made.
| Version | How it is built | Notes |
|---|---|---|
| v1 | Timestamp plus the machine MAC address | Sortable by time, but it leaks the hardware address and the moment of creation |
| v2 | DCE security variant with a POSIX user or group id | Almost never used outside legacy DCE systems |
| v3 | MD5 hash of a namespace and a name | Deterministic: the same inputs always give the same UUID |
| v4 | 122 random bits | The general purpose default and what this tool generates |
| v5 | SHA-1 hash of a namespace and a name | Deterministic like v3 and preferred over it because SHA-1 beats MD5 |
| v7 | Unix millisecond timestamp followed by random bits | Time ordered and sortable, well suited to database primary keys |
Reading the Version and Variant Nibbles
Not every character in a v4 UUID is random. Two positions are reserved. The 13th hexadecimal digit (the first character of the third group) always holds the version number, so in a version 4 value it is literally the character 4. The 17th hexadecimal digit (the first character of the fourth group) holds the variant bits, and for the standard variant it is always one of 8, 9, a, or b.
That is why a version 4 UUID carries 122 random bits rather than the full 128: four bits go to the version and two to the variant. It also gives you a cheap sanity check when validating input, because a value with a 4 in the wrong place is not a well formed v4 UUID.
How Unique Is Unique?
With 122 random bits there are roughly 5.3 times 10 to the power 36 possible v4 values. Applying the birthday bound, you would need to generate on the order of 2.7 times 10 to the power 18 UUIDs before reaching a 50 percent chance of a single collision. That is about 2.7 billion billion identifiers. Generating a million per second, you would be waiting roughly 85,000 years to reach that point.
The honest framing is this: a v4 collision is not impossible, it is simply so unlikely that other failure modes in your system (disk corruption, a bad deploy, a weak random source) are vastly more probable. The one real risk worth guarding against is a broken random source, which is why generating from a cryptographic source rather than a general purpose one matters.
The nil UUID
One value is special: 00000000-0000-0000-0000-000000000000, called the nil UUID. It is reserved as an explicit "no identifier" sentinel. Some systems use it as a default column value, so treat it as a null marker rather than as a real id.
UUIDs vs Auto-Increment Integers as Database Keys
Choosing a primary key type is a real tradeoff rather than a matter of taste. UUIDs win on independence and privacy. Integers win on size and physical ordering.
| Concern | UUID | Auto-increment integer |
|---|---|---|
| Coordination | None needed, any client can mint a key offline | Requires the database to hand out the next value |
| Enumeration | Cannot guess the next id from one you hold | Trivially guessable, exposing record counts and other rows |
| Storage | 16 bytes binary, 36 characters as text | 4 or 8 bytes |
| Index locality | Random v4 values scatter inserts across the index | New rows append to the end of the index |
| Merging datasets | Safe, keys from separate systems will not clash | Painful, ranges overlap and need remapping |
The index locality problem is the one that bites at scale: because v4 values are random, each insert lands in an unpredictable place in a B-tree index, causing page splits and poor cache behaviour. Version 7 exists precisely to fix this. It puts a millisecond timestamp in the leading bits, so newly generated values sort near each other and inserts stay sequential while keeping the coordination-free property.
How This Generator Works
The tool above produces version 4 UUIDs using the Web Crypto API built into your browser, which draws from the operating system entropy pool rather than a fast pseudorandom function. Nothing is requested from a server and nothing is transmitted, so the identifiers you generate exist only on your device. Common uses include database primary keys, request correlation ids in logs, idempotency keys for payment and retry logic, file and object storage names, and test fixtures that need to stay distinct across runs.
Need a different kind of identifier or a hash instead? Browse the full developer tools collection for hash generators, random number generators, and encoders that pair well with id generation.
Frequently asked questions
How do I generate a UUID v4?
Choose quantity and press Generate to create random version-4 UUIDs.
Is a GUID the same as a UUID?
In common use, yes. Check byte-order and serialization conventions in the systems exchanging them.
Can two UUIDs collide?
A collision is possible in theory but very unlikely with sound random generation. Use a database uniqueness constraint where needed.
Are UUID v4 values cryptographically random?
This generator uses the browser crypto API for random UUID values.
Can I generate UUIDs in bulk?
Yes. Choose the supported batch quantity and copy all generated values.