UUID Generator & Validator
Generate random UUIDs (v4) or time-ordered UUIDs (v7) for database keys, then copy or download them. Paste a UUID below to see its version and timestamp.
Inspect a UUID
The version, variant and creation time (v1, v6, v7) will appear here.
How to use it
- Choose Version 4 for ordinary random IDs, or Version 7 for database keys that sort by creation time.
- Enter how many you need (1 to 1000), then pick the format: uppercase, no hyphens, or wrapped in braces like a Windows GUID.
- Press Copy or Download .txt. Press Generate new to replace them all.
- To check a UUID, paste it into Inspect a UUID. Its version, variant and creation time (for v1, v6 and v7) appear right away.
UUID versions compared
A UUID (Universally Unique Identifier) is a 128-bit number written as 32 hexadecimal digits in five groups, for example 017f22e2-79b0-7cc3-98c4-dc0c0c07398f. The first digit of the third group (here 7) is the version, and the top bits of the fourth group are the variant. The current standard is RFC 9562 (May 2024), which replaced RFC 4122 and added versions 6, 7 and 8.
| Version | Contents | Sorts by time | Notes |
|---|---|---|---|
| 1 | Time (100 ns steps since 15 Oct 1582) + node | No | Node is usually the MAC address |
| 3 | MD5 of namespace + name | No | Same name, same UUID |
| 4 | 122 random bits | No | The most common |
| 5 | SHA-1 of namespace + name | No | Preferred over v3 |
| 6 | v1 time, most significant part first | Yes | For systems already using v1 |
| 7 | 48-bit Unix milliseconds + 74 random bits | Yes | RFC 9562's choice for new data |
| 8 | Free-form vendor layout | Depends | For special needs |
Version 2 (DCE Security) is reserved and rarely used. There are also two special values: the Nil UUID (all bits 0) and the Max UUID (all bits 1).
What are the odds of two v4 UUIDs colliding?
A v4 UUID has 122 random bits; the other 6 hold the version and variant. That gives 2122, about 5.3 × 1036, possible values. By the birthday paradox, the chance of any two being equal among n UUIDs is roughly n² ÷ (2 × 2122). For one billion UUIDs that is (109)² ÷ (1.06 × 1037) ≈ 9.4 × 10-20. A 50% chance is only reached at about 2.7 × 1018 UUIDs, which means generating one billion per second for 86 years.
That arithmetic only holds if the random source is good. This tool uses only crypto.getRandomValues, the browser's cryptographic random generator. UUIDs built with Math.random do not meet that bar.
Why v7 makes a good database key
B-tree indexes, used by MySQL, PostgreSQL and most other databases, keep keys in sorted order. Random v4 UUIDs land at random positions in the index, so index pages split often and caching works poorly. RFC 9562 cites this index locality problem as one of the reasons for the new versions. A v7 UUID starts with the time in milliseconds, so new rows always go at the end of the index, as with an auto-increment number, yet the application can create the key without asking the database.
Here the 12 bits after the timestamp are a counter (method 1 in RFC 9562 section 6.2). It goes up by one for each UUID within the same millisecond, so 1000 UUIDs generated at once still come out in order. The trade-off is that a v7 UUID reveals when it was created: anyone can read the time with the inspector above. If creation time must stay private, use v4.
Questions
Are these UUIDs really unique?
What is the difference between a UUID and a GUID?
{919108F7-52D1-4320-9BAC-F847DB4148A8}. Tick Uppercase and Braces to get that format.