How it works
- Choose the identifier type and how many.
- Set the output format.
- Copy or download the list.
Why use it
- UUID v4, v7, v5, nil and ULID.
- Up to 10,000 at once.
- JSON, CSV, quoted and braced formats.
- Decode the timestamp inside v7 and ULID.
UUID v4, v7, v5 and ULID: which identifier to use
The kinds, side by side
| Kind | Made from | Sorts by time | Use it for |
|---|---|---|---|
| UUID v4 | 122 random bits | No | General ids, tokens, file names |
| UUID v7 | Time in milliseconds plus 74 random bits | Yes | Database keys, logs, events |
| UUID v5 | A namespace and a name, hashed with SHA-1 | No | The same id for the same name, every time |
| ULID | Time in milliseconds plus 80 random bits | Yes | Short, readable sortable ids |
| Nil | All zeros | No | A placeholder meaning "no id" |
Version 4: random
A v4 UUID is 122 random bits in a fixed layout, such as 9b2f6c1e-4a7d-4e3b-8f21-5c9d0a7e3b64. The chance of two ever being the same is so small it can be ignored: you would need to make about 2.7 quintillion of them for a 50 percent chance of one collision. They are the default choice whenever an id only has to be unique.
Version 7 and ULID: random, but in time order
Random ids have a cost in databases: new rows are inserted all over the index instead of at its end, which slows large tables down. A v7 UUID starts with the time it was made, to the millisecond, followed by random bits, so ids made later sort later and inserts stay at the end of the index. Ids made in the same millisecond by this generator still come out in order. Use a fixed time sets the timestamp, handy for test data.
A ULID carries the same idea in 26 characters of Crockford Base32, such as 01JA8Z3V6Q8X2M7K4N9R5T1B0C, shorter than a UUID and free of easily confused letters. Use v7 where a column or API expects a UUID, and ULID where shorter text is welcome.
Version 5: the same name, the same id
A v5 UUID is not random: it is a hash of a namespace and a name. example.com in the DNS namespace always gives the same UUID, on any computer, in any language. That makes it useful for giving stable ids to things that already have a unique name, such as URLs or email addresses, without storing a table of them. Choose DNS, URL, OID or X.500 as the namespace, or a custom UUID of your own.
Inspecting an id
Paste any UUID or ULID into Inspect an id to see what it is: the version, the variant, and for time based ids the moment it was created. Useful when debugging, for example to see when a record in a database was made from its key alone.
Formats for pasting
Choose upper or lower case, with or without hyphens, and wrap each id in double quotes, single quotes or braces for code. Separate them by new lines or commas, or write them as a JSON array or a CSV column, then copy all or save them as a text, CSV or JSON file. Lower case with hyphens is the standard form and the safest choice.
If something goes wrong
- An id is not recognised. It is not a valid UUID or ULID: check its length and characters. UUIDs have 32 hexadecimal digits; ULIDs have 26 characters.
- v4 ids are slowing down a database. Switch new keys to v7 so inserts arrive in order.
Questions and answers
What is the difference between v4 and v7?
Version 4 is fully random. Version 7 starts with a timestamp, so ids sort by creation time, which is friendlier to database indexes.
Are these random values secure?
They come from your browser cryptographic random number generator.
Could two ids collide?
The chance is negligible for random UUIDs.