UUID and ULID: versions, formats and generators
A UUID is a 128-bit identifier written as 32 hexadecimal digits in five groups (8-4-4-4-12). The first digit of the third group is the version, which says how the ID was made. Random and time-based versions can be generated anywhere without coordination, which is why they are popular as database keys, request IDs and file names.
Updated · How we write and check guides
Which one to use
Use UUID v4 when the ID should reveal nothing. Use UUID v7 or ULID for database primary keys: they sort by creation time, so new rows land at the end of the index instead of at random places in it.
| Format | Sorts by creation time | Contains a timestamp | Text length |
|---|---|---|---|
| UUID v4 | No | No | 36 characters |
| UUID v7 | Yes | Yes (milliseconds) | 36 characters |
| ULID | Yes | Yes (milliseconds) | 26 characters |
UUID v4: random
Version 4 fills 122 of its 128 bits with random data. Collisions are practically impossible, but the values have no order, so using them as a primary key scatters inserts across a B-tree index.
Generate UUID v4, v7, v1 or ULID identifiers in your browser. Pick a format, choose how many, then copy or download the batch.
UUID v7: time-ordered
Version 7, defined in RFC 9562 (2024), starts with a 48-bit Unix timestamp in milliseconds followed by random bits. Newer IDs sort after older ones, so inserts stay close to sequential, and the creation time can be read back from the ID. That also means a v7 ID discloses when its record was created.
Create time-ordered UUID v7 identifiers whose leading 48-bit timestamp keeps database indexes append-friendly. Copy, download or seed a batch.
ULID
A ULID also holds a 48-bit millisecond timestamp and 80 random bits, but it is written as 26 Crockford base32 characters. The text sorts in creation order and leaves out the easily confused letters I, L, O and U. A ULID is 128 bits, the same size as a UUID, so it fits a UUID database column.
Generate ULIDs — 26-character Crockford base32 identifiers that sort lexicographically — with a live creation timestamp, in your browser.
Validate and inspect an ID
To check what kind of ID you have, read the version digit and the variant bits; for v1 and v7 IDs the creation time can be decoded as well.
Check any UUID or ULID and read what it contains: syntax, version, variant, node, and the creation timestamp encoded in v1 and v7 ids.
More tools in Generators & Utilities.