UUID Generator
Pick a version to generate one. Every ID is produced in your browser and never leaves it.
- UUID v1 — Timestamp and MAC addressSortable, but reveals when and where it was made.
- UUID v2 — DCE securityNever fully specified. Avoid.
- UUID v3 — MD5 of a name in a namespaceDeterministic: the same input always gives the same UUID.
- UUID v4 — RandomThe default choice when you just need an identifier.
- UUID v5 — SHA-1 of a name in a namespaceDeterministic, and the more common of the two hashed versions.
- UUID v7 — Unix timestamp and randomSorts by creation time. The best choice for database keys.
What is a UUID?
A UUID is a Universally Unique IDentifier: a 128-bit number used to identify something without coordinating with anyone else. It is usually written as 32 hexadecimal characters in five hyphenated groups.
UUIDs come in several versions. v4 is random, v1 and v6 encode a timestamp and a MAC address, v3 and v5 hash a name inside a namespace, and v7 encodes a Unix millisecond timestamp followed by random bits.
Why use UUIDs?
UUIDs can be generated anywhere, by anyone, with no central authority, and still be safely assumed not to collide. That makes them useful for distributed systems, offline clients, and merging data from separate databases.
They are also instantly recognisable, which makes them easy to pick out of logs.
Some databases (for example Postgres) store a UUID as a 128-bit integer rather than a 36-character string, so using one as a primary key costs far less than it looks.
What are the downsides?
Uniqueness is probabilistic, not guaranteed. The odds of two v4 UUIDs colliding are negligible, but they are not zero.
Some versions leak information. A v1 or v6 UUID contains the MAC address of the machine that generated it and the moment it was generated, which is enough to correlate a device across systems. You can see exactly what a UUID gives away with the UUID decoder.
Time-ordered IDs are also partly guessable, so they are a poor choice for anything that doubles as a secret, such as a password reset token.