Generate UUIDs
Validate and inspect a UUID
UUIDs are generated in your browser with its cryptographically secure random number generator (crypto.getRandomValues). Nothing is sent to or logged on a server.
How to Use This UUID Generator
Choose v7 for time-ordered IDs or v4 for purely random ones, set how many you need (1 to 1,000), and press Generate UUIDs. The format options apply instantly to the current batch:
- Uppercase for systems that print GUIDs in capitals.
- Hyphens off for the 32-character compact form.
- Braces for the
{…}style used by Windows and the .NETGuidtype. - A urn:uuid: prefix for the URN form defined in the standard.
Copy all puts one UUID per line on your clipboard, and Download .txt saves the list as a file. Every value comes from your browser's cryptographically secure random number generator, through crypto.randomUUID() for v4 and crypto.getRandomValues() for v7.
The second panel validates and decodes any UUID you paste. It accepts upper or lower case, with or without hyphens, braces or the URN prefix. It shows the canonical lowercase form, the version and variant, and for time-based versions the timestamp hidden inside. That is handy for working out when a database row or log event was created from its v7 key, or for spotting a v1 UUID that exposes a machine's network address.
What a UUID Is
A Universally Unique Identifier is a 128-bit value that systems can create independently, with no central registry, and still expect never to clash. It is written as 32 hexadecimal digits in five groups, 8-4-4-4-12, for example 017f22e2-79b0-7cc3-98c4-dc0c0c07398f. Two places in that string are fixed by the standard:
- The first digit of the third group is the version:
7in the example. - The first digit of the fourth group holds the variant. For standard UUIDs its top two bits are
10, so the digit is always 8, 9, a or b.
Microsoft calls the same thing a GUID; the formats are compatible. The current specification is RFC 9562, published in May 2024, which obsoletes RFC 4122 from 2005. It keeps versions 1 to 5 and adds three new ones:
- Version 6 reorders v1's timestamp so the IDs sort by time.
- Version 7 is built on Unix time in milliseconds.
- Version 8 is reserved for custom, vendor-specific layouts.
It also names the all-zeros Nil UUID and the all-ones Max UUID. Versions 3 and 5 are name-based: they hash a namespace and a name with MD5 or SHA-1, so the same input always gives the same UUID. Version 2, for DCE security, is rarely seen.
Worked Example: Decoding a Version 7 UUID
Click the v7 example in the inspector, which loads the test vector from RFC 9562 Appendix A: 017f22e2-79b0-7cc3-98c4-dc0c0c07398f.
- Timestamp: the first 12 hex digits,
017f22e279b0, are a 48-bit big-endian number. In decimal that's 1,645,557,742,000, a Unix time in milliseconds, which the tool shows as 2022-02-22 19:22:22.000 UTC. - Version: the digit after the second hyphen is
7. - Random bits: the next three digits,
cc3, are the 12-bit field RFC 9562 callsrand_a. - Variant: the fourth group starts with
9, binary1001. Its leading10marks the standard variant, and the remaining 62 bits are random (rand_b).
The v1 example from the same appendix, c232ab00-9414-11ec-b3c8-9f6bdeced846, decodes to exactly the same instant. Version 1 counts 100-nanosecond intervals from 15 October 1582, the start of the Gregorian calendar, and splits that count across three fields in reverse order, which is why v1 UUIDs don't sort by time.
How Unlikely Is a v4 Collision?
A version 4 UUID has 122 random bits; the other 6 are the version and variant markers. That gives 2122, about 5.3 × 1036, possible values. The birthday bound gives the chance that at least one pair matches among n random UUIDs: p ≈ 1 − e−n²/(2·2122).
- A billion UUIDs gives a probability of about 9.4 × 10−20.
- The chance only reaches one in a billion at roughly 103 trillion UUIDs.
- It takes about 2.7 × 1018 UUIDs to reach 50%. Generating a billion per second, that is about 86 years.
In practice, the real risk is a bad random number generator: a seeded Math.random(), a cloned virtual machine image, or an ID truncated to fit a short column. It isn't the mathematics. That is why this tool only uses the browser's cryptographic generator.
Why v7 Makes Better Database Keys
Most relational databases store primary keys in a B-tree index. Random v4 keys land at random positions, so every insert touches a different leaf page. Pages split, the index ends up partly empty and fragmented, and the working set stops fitting in memory as the table grows. Version 7 keys start with the creation time, so new rows go to the end of the index, the same way an auto-increment integer does. You keep the benefits of UUIDs: IDs can be created on any server or client without a round trip, and they can be merged across databases without clashes. You also get index locality, and IDs that sort by creation time.
The cost is that a v7 UUID reveals when it was made, to the millisecond, which matters if IDs are public and creation times are sensitive. Within one millisecond, RFC 9562 lets a generator use part of the random field as a counter to keep IDs in order. This generator seeds a 12-bit counter randomly each millisecond and increments it, so a batch of 1,000 always comes out in ascending order. That still leaves 62 random bits per ID. Store UUIDs in a native 16-byte type where one exists, such as PostgreSQL's uuid (PostgreSQL 18 added a built-in uuidv7() function) or BINARY(16) in MySQL. A 36-character string takes more than twice the space and compares more slowly.
Formats and Common Mistakes
- Case: RFC 9562 says to output lowercase and to accept either case when reading. Compare UUIDs case-insensitively, or normalize them first.
- Not a secret: a UUID is an identifier, not a password or session token. v4 is hard to guess, but a v7 is partly predictable from the time, and neither should be the only thing protecting a private link.
- v1 privacy: version 1 often embeds the generating machine's MAC address. Prefer v7 for new time-ordered IDs.
- Hand-made UUIDs: made-up values with the wrong version or variant digits will fail validation in strict libraries. Paste one into the inspector to check it.
For a longer comparison of every version, read our guide UUID v4 vs v7. If you work with the timestamps inside v7 IDs, the Unix timestamp converter reads the same millisecond values.
Frequently Asked Questions
Should I use UUID v4 or v7?
Use v7 for database primary keys and anything you want sorted by creation time, because its timestamp prefix keeps B-tree indexes compact. Use v4 when an ID must reveal nothing, including when it was created. Both are standard in RFC 9562, and both are practically collision-free.
Can two UUIDs ever be the same?
In theory yes, in practice no, provided they come from a proper cryptographic random generator. A v4 UUID has 122 random bits, so you would need about 103 trillion of them for a one-in-a-billion chance of any duplicate. Real-world duplicates come from broken random number generators or copied values, not chance.
What is RFC 9562?
RFC 9562, published by the IETF in May 2024, is the current UUID standard. It replaces RFC 4122, keeps versions 1 to 5, adds the time-ordered versions 6 and 7 and the custom version 8, and defines the Nil and Max UUIDs.
Is a GUID the same as a UUID?
Yes. GUID is Microsoft's name for a UUID. The bits are the same, though Windows tools often display GUIDs in uppercase and wrapped in braces, which this generator can do with the Uppercase and Braces options.
Can I get the creation time from a UUID?
Only from time-based versions. A v7 UUID stores Unix time in milliseconds in its first 48 bits, and v1 and v6 store a count of 100-nanosecond intervals since 15 October 1582. Paste one into the inspector to see the date. A v4 UUID is random and contains no time.
Are UUIDs safe to use as secret tokens?
Not on their own. UUIDs are designed to be unique, not secret. A v4 UUID is hard to guess, but a v7 UUID is partly predictable from the time. For password-reset links or session tokens, use a dedicated random token of at least 128 bits and expire it.
Sources: RFC 9562 (Universally Unique IDentifiers); MDN: crypto.randomUUID(); MDN: crypto.getRandomValues(); PostgreSQL: UUID functions.
Related Articles
Expert guides and educational resources to help you master the math.