How to use the Uuid generator
- 1Select UUID version 4 (random) or version 7 (Unix timestamp plus random).
- 2Enter how many to generate, from 1 to 500.
- 3Choose formatting options: uppercase, no hyphens, or braces for systems such as the Windows registry that expect {…}.
- 4Generate, then copy the list, one UUID per line.
How it works
Version 4 UUIDs contain 122 random bits; the remaining 6 bits mark the version and variant. The random bits come from crypto.getRandomValues, the browser's cryptographically secure generator, so values are unpredictable as well as unique.
Version 7, defined in RFC 9562 (published in 2024), puts a 48-bit Unix timestamp in milliseconds at the front, followed by random bits. Because the timestamp comes first, v7 UUIDs sort in roughly the order they were created. That makes them friendlier as database primary keys: new rows are appended near the end of an index instead of being scattered through it, as happens with random v4 values.
UUIDs are generated in your browser and are not recorded or sent anywhere. The version digit is the first character of the third group: 4 for v4, 7 for v7.
Formula
P(collision) ≈ n² ÷ (2 × 2¹²²)- n
- number of v4 UUIDs generated
Valid when P is small. It assumes a correctly working random number generator; flawed or badly seeded generators are the realistic source of duplicates.
Worked examples
Chance of a duplicate among one billion v4 UUIDs
- 1n = 10⁹, so n² = 10¹⁸
- 22 × 2¹²² ≈ 1.06 × 10³⁷
- 310¹⁸ ÷ 1.06 × 10³⁷ ≈ 9.4 × 10⁻²⁰
About 1 in 10 quintillion (10¹⁹): negligible for any practical system.
How many v4 UUIDs for a 50% chance of any duplicate?
- 1Solve n ≈ √(2 × 2¹²² × ln 2)
- 2n ≈ 2.7 × 10¹⁸
About 2.7 quintillion UUIDs, or a billion per second for roughly 86 years.
Reading a v7 UUID
- 1Example: 0192a4f3-6b10-7c3e-8d21-5f4e9a0b7c62
- 2The first 12 hex digits (0192a4f36b10) are the millisecond timestamp
- 3The 7 at the start of the third group marks version 7
Later UUIDs from the same clock will sort after this one.
Should I use UUID v4 or v7?
Neither version is a secret. A UUID should not be used as a password or as the only protection for a private link, even though v4 values are hard to guess.
- Use v7 for database primary keys and anything you want to sort by creation time. It keeps B-tree indexes compact and inserts fast.
- Use v4 when the ID must reveal nothing, including when it was created, such as public tokens or identifiers in URLs.
- Either works for general unique IDs such as file names, message IDs or correlation IDs in logs.
Frequently asked questions
Can two UUIDs ever be the same?
It is mathematically possible but, with a proper random source, so unlikely that it can be ignored in practice. Real-world duplicates almost always come from bugs, such as copying an ID or using a weak random generator.
What is the difference between a UUID and a GUID?
Nothing meaningful. GUID (globally unique identifier) is Microsoft's name for the same 128-bit format, often written in uppercase with braces.
Does a v7 UUID reveal when it was created?
Yes. Anyone can read the millisecond timestamp from the first 48 bits. If creation time is sensitive, use v4.
Are UUIDs case-sensitive?
No. The hex digits a–f and A–F are equivalent, and RFC 9562 recommends lowercase output. Some systems store them uppercase, so the option is provided.
How many random bits does a v7 UUID have?
Up to 74, after the 48-bit timestamp and the 6 version and variant bits. Collisions within the same millisecond are still extremely unlikely at normal volumes.
What happened to UUID versions 1 to 3 and 5?
They still exist. Version 1 uses a timestamp and MAC address, and versions 3 and 5 are derived by hashing a name. Version 7 is now generally recommended over v1 for time-based IDs.