UUID generator
- Runs in your browser
- No signup
- Formula shown below
- Reviewed
A version 4 UUID is a 128-bit identifier in which 122 bits are random, with 4 bits fixed as the version and 2 bits as the variant. That yields 2¹²², or approximately 5.32 × 10³⁶, distinct values. UUIDs are written as 32 hexadecimal digits in the 8-4-4-4-12 pattern, such as 3f2504e0-4f89-41d3-9a0c-0305e82c3301.
Result
First of 5 version 4 UUIDs
a00087fb-f747-4cb8-adfe-747d23673f27
122 random bits, version nibble = 4, variant bits = 10
- Version
- 4 (random)
- Random bits
- 122
- Distinct values
- 5.32 × 10³⁶
- Generated
- 5
- #1
- a00087fb-f747-4cb8-adfe-747d23673f27
- #2
- 7d1165c4-4930-4a6d-97cc-4b34a88bc231
- #3
- b874c5fe-3dc1-4752-a93f-26b99320430c
- #4
- 9fdd3dfd-b766-4dad-b3ec-b1ebd5ef1d0a
- #5
- de4be182-efb4-4aad-b221-fa29631e6653
A version 4 UUID contains 122 random bits, giving 2¹²² — about 5.3 × 10³⁶ — possible values. Generating one billion UUIDs per second for a century would still leave the probability of a single collision below one in a billion. The first of the 5 generated identifiers is a00087fb-f747-4cb8-adfe-747d23673f27, and every one of them was created inside this page.
Generated locally with the Web Crypto CSPRNG, following RFC 9562. No identifier is transmitted or recorded.
How to use the UUID generator
- 01
Choose how many
Enter the number of UUIDs to generate, up to 200 in a single request.
- 02
Pick a format
Toggle uppercase, wrapping braces, or hyphen removal to match the format your database or platform expects.
- 03
Copy the output
Press copy to place the generated identifiers on your clipboard, ready to paste into a seed file or migration.
- 04
Regenerate for a fresh set
Press regenerate to draw an entirely new batch. Previous values are not retained anywhere.
The formula
xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx where N is one of 8, 9, a or b
- 4
- The version nibble, fixed at 4 to identify a randomly generated UUID.
- 122
- The number of genuinely random bits, after the 6 fixed version and variant bits.
- x
- A random hexadecimal digit, contributing 4 bits each.
- N
- The variant nibble. Its two most significant bits are set to 10, restricting it to 8, 9, a or b.
Defined by RFC 9562, which superseded RFC 4122 in 2024. The 6 fixed bits are what distinguish a version 4 UUID from a version 1 timestamp-based one, and they reduce the random space from 2¹²⁸ to 2¹²².
Worked example
- How many
- 5
- Uppercase
- No
- Braces
- No
- Hyphens
- Yes
- Result
- Five version 4 UUIDs, e.g. 3f2504e0-4f89-41d3-9a0c-0305e82c3301
Sixteen random bytes are requested from the Web Crypto CSPRNG. Byte 6 has its high nibble replaced with 4 to mark the version, and byte 8 has its two most significant bits set to 10 to mark the variant. The remaining 122 bits stay random. The bytes are then rendered as 32 lowercase hexadecimal digits and grouped 8-4-4-4-12. Generating one billion per second for a century would leave the collision probability below one in a billion.
Frequently asked questions
What is a UUID?
A universally unique identifier is a 128-bit value used to label something without a central authority issuing the labels. Any system can generate one independently and rely on it not colliding with an identifier generated elsewhere. UUIDs are standardised in RFC 9562 and are written as 32 hexadecimal digits grouped as 8-4-4-4-12.
What is the difference between UUID versions?
Version 1 encodes a timestamp and a MAC address, which leaks host information. Version 3 and version 5 hash a name within a namespace, producing deterministic identifiers. Version 4 is purely random. Version 7, added in RFC 9562, prefixes a Unix millisecond timestamp to random bits, making identifiers sort chronologically while remaining unpredictable.
Can two UUIDs ever be the same?
A collision is possible but negligible. With 2¹²² random values, generating one billion UUIDs per second for 100 years leaves the probability of a single collision below one in a billion. Reaching a 50% collision chance would require roughly 2.7 × 10¹⁸ identifiers. In practice, collisions arise from a broken random source, never from exhausting the space.
Should a UUID be used as a database primary key?
The database engine decides. Version 4 UUIDs are random, so inserting them into a clustered B-tree index causes page splits and index fragmentation, hurting write throughput at scale. Version 7 UUIDs are time-ordered and avoid that problem. PostgreSQL handles random UUIDs better than clustered-index engines such as MySQL with InnoDB.
Is a UUID secure enough to use as a secret token?
A version 4 UUID carries 122 bits of entropy from a cryptographic source, which is sufficient for an unguessable identifier such as a password-reset token. Versions 1, 3 and 5 are not, because they are derived from timestamps, MAC addresses or hashed names and are therefore predictable or reconstructible.
What is the difference between a UUID and a GUID?
The two terms describe the same thing. GUID, for globally unique identifier, is Microsoft's name for the format and appears throughout Windows and .NET APIs. Microsoft conventionally renders them in uppercase and wrapped in braces, but the underlying 128-bit value and the RFC 9562 layout are identical.
Sources
- RFC 9562 — Universally Unique IDentifiers (UUIDs) — IETF
- Web Crypto API — getRandomValues specification — World Wide Web Consortium
- NIST SP 800-90A — random bit generation — US National Institute of Standards and Technology
Last reviewed: · Formula and sources verified by Syed Aqeel Ahmad Gillani. See the methodology for how every calculation is derived.