UUID generator and checker
Make version 4 (random) or version 7 (time-ordered) UUIDs, one or up to a thousand, copy them or save them as a text file, and paste any UUID to see its version, variant and the time inside it. Everything runs in your browser; nothing is uploaded.
Generate UUIDs
Version 4 is 122 random bits. Version 7 starts with the current time in milliseconds, so UUIDs made later sort after earlier ones; within the same millisecond a counter keeps a batch in creation order. The nil and max UUIDs are fixed special values, not unique identifiers.
Everything is made in your browser with the browser's secure random number generator. Nothing is sent, saved or logged.
Check a UUID
Hyphens, upper case, braces { } and a urn:uuid: prefix are all accepted.
Valid UUID
- Standard form
- 017f22e2-79b0-7cc3-98c4-dc0c0c07398f
- Version
- 7: Unix time in milliseconds, then random
- Variant
- RFC 9562 / RFC 4122 (the normal one)
- Embedded time (UTC)
- 2022-02-22 19:22:22.000 UTC (Unix time in milliseconds)
- Note
- This is the time the maker wrote into the UUID. Nothing proves it is true, because anyone can write any time.
Chance of two being the same
Chance that at least two of them match: 9.40 x 10^-20
About 1 in 1.06 x 10^19.
Computed as p = 1 - e^(-n(n-1) / 2^123), the usual birthday estimate for 122 random bits, and it assumes a perfect random source. The chance of a match reaches 50 percent only after about 2.7 x 10^18 UUIDs.
How it works
- •Randomness comes from your browser's secure random number generator (crypto.getRandomValues), never from Math.random. A version 4 UUID is 128 bits with 6 of them fixed to mark the version and variant, leaving 122 random bits.
- •A version 7 UUID (RFC 9562) starts with the current Unix time in milliseconds in the first 48 bits, then the version, the variant and random bits. UUIDs made in the same millisecond use a counter that only goes up, so a batch sorts in the order it was created, even if you press Generate again.
- •If the clock moves backwards, the tool keeps using the last time it saw instead of creating a UUID that sorts earlier. The time inside a UUID is simply what its maker wrote, and nothing proves it is real.
- •Why v7 can suit database keys: index entries are kept in key order. Random v4 keys land at random places in the index, so each insert may touch a different part of it. Version 7 keys grow with time, so new rows go in at the end, next to the entries just written. That is a fact about ordering, not a promise of speed; the effect depends on your database, table size and workload, so measure yours. Choose v4 when the creation time should not be visible in the ID.
- •Collisions: with n random version 4 UUIDs the chance of at least one pair matching is about 1 - e^(-n(n-1) / 2^123), assuming a perfect random source. It reaches 50 percent only around 2.7 x 10^18 UUIDs, which at a billion a second takes about 86 years. For a million UUIDs the chance is about 9.4 x 10^-26.
- •The checker reads version 1 and version 6 times as 100-nanosecond steps counted from 15 October 1582, and version 7 times as Unix milliseconds. It accepts upper or lower case, no hyphens, braces and a urn:uuid: prefix.
Questions
- Should I use UUID v4 or v7?
- Use v4 when you want an ID that reveals nothing, such as one shown in a link. Use v7 when IDs are database keys and you want new rows to sort after older ones, which keeps inserts together in the index. A v7 ID does show roughly when it was made.
- Are these UUIDs safe to use?
- They come from the browser's cryptographic random generator, which is the same source websites use for secure tokens. Two generated UUIDs matching is not a realistic concern. A UUID is an identifier though, not a secret: do not use one as a password or an access key.
- What are the nil and max UUIDs?
- Nil is all zeros and max is all ones. The standard defines them as special values, for example to mean "no value". They are the same every time and do not identify anything.
- Is anything uploaded or saved?
- No. The UUIDs are made and checked in your browser, nothing is sent to a server, and nothing is stored. Closing or refreshing the page clears them.