UUID Generator: Which UUID Version to Use, and How to Read One
By FindMySum · Last reviewed
This UUID generator makes random version 4 UUIDs by default, and time-ordered version 7, name-based version 5, legacy versions 1, 3 and 6, the nil and max UUIDs, or ULIDs, up to 1,000 at a time. Switch to decode mode to check a UUID you already have: it shows the version, the variant and, for time-based IDs, the moment it was created.
When to use which
- Version 4 is the everyday choice: a random identifier for a record, a file, a request or a test fixture.
- Version 7 is better for database primary keys, because IDs made later sort later.
- Version 5 turns a name into a stable UUID:
www.example.comin the DNS namespace is always2ed6657d-e927-568b-95e1-2665a8aea6a2. Use it when two systems must agree on an ID without talking to each other. - ULID is a 26-character time-ordered ID that is shorter to read and type than a UUID.
- Versions 1, 3 and 6 exist for compatibility with older systems.
How to use the tool
- Pick a version and how many IDs you need.
- For version 3 or 5, choose the namespace and type the name.
- Copy the IDs or download them as a text file, and press Generate new for another batch.
- To read an existing ID, switch to Decode and paste one or more IDs, one per line. Braces, a
urn:uuid:prefix, missing hyphens and either case are all accepted.
A worked example
RFC 9562 gives 017F22E2-79B0-7CC3-98C4-DC0C0C07398F as its version 7 example. The 13th hex digit is 7, so it is version 7. The 17th digit, 9, starts with the bits 10, which is the RFC 9562 variant. The first 12 hex digits, 017F22E279B0, are 1,645,557,742,000 milliseconds after 1 January 1970: 22 February 2022 at 19:22:22 UTC, the same instant as the RFC's version 1 and version 6 examples.
Common mistakes
Using UUIDs as secrets. A UUID is hard to guess but isn't designed as a password or an access token; use a token generator for that.
Expecting v4 to sort by time. Random UUIDs have no order. If you need "newest first", use version 7 or store a timestamp.
Comparing as text in different cases. ABC… and abc… are the same UUID; normalise to lower case before comparing.
To turn a timestamp into a date by hand, use the Unix timestamp converter.