How to use the ULID generator
- Leave Mode on Generate.
- Set How many ULIDs (up to 1,000).
- Keep Monotonic (same-millisecond IDs keep their order) ticked unless you want fully random tails, and tick Lowercase if your system stores IDs in lower case.
- Press Generate and copy the list.
- To read a date, switch Mode to Read the timestamp, paste the ULID and read Created (UTC) and Unix milliseconds.
What it does and when to use it
ULIDs (Universally Unique Lexicographically Sortable Identifiers) are popular as database keys, event IDs and log IDs. Because the time comes first, new rows land at the end of an index, which keeps inserts fast, and a plain text sort puts records in creation order. They are also URL-safe and avoid letters that are easy to misread.
The reader is useful when debugging: paste an ID from a log or a URL and you know when the record was made, without a database query. For the standard UUID layout with a timestamp, see version 7 in the UUID generator. For MongoDB’s own 12-byte IDs, use the ObjectId generator. For short random IDs without a timestamp, try the Nano ID generator.
How it works
A ULID has two parts, both in Crockford Base32 (0–9 and A–Z without I, L, O and U):
- Timestamp: 10 characters for the milliseconds since 1 January 1970 UTC. This is 48 bits, enough until the year 10889.
- Randomness: 16 characters, or 80 bits, from
crypto.getRandomValues.
In monotonic mode, the tool increments the 80-bit tail by one for each further ID in the batch. To decode, it reads the first 10 characters as a base-32 number of milliseconds. The first character can only be 0 to 7, because a larger value would not fit in 48 bits.
Worked examples
- The specification’s example. Reading
01ARZ3NDEKTSV4RRFFQ69G5FAVgivesCreated (UTC): 2016-07-30T23:54:10.259ZandUnix milliseconds: 1469922850259. - A monotonic batch of three. One run gave
01M4BPDFRWSRP9JG8TM2K25GPN,…GPPand…GPQ: the same timestamp, with the last character counting up. Note that Crockford Base32 skips O, so P follows N. - An impossible ULID.
81ARZ3NDEKTSV4RRFFQ69G5FAVis refused with “The first character of a valid ULID is 0–7 (48-bit timestamp).”
Limits and tips
- The time comes from your device clock. If the clock is wrong, so are the ULIDs.
- All IDs in a batch share one millisecond, so the batch says nothing about real spacing between events.
- Mixed upper and lower case sort differently in many databases. Pick one case and keep it.
Frequently asked questions
How is a ULID different from a UUID?
What does Monotonic do?
Does a ULID reveal anything?
Why does decoding accept I, L and O?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.