What is a ULID generator?
A ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier written as 26 characters, such as 01HF7YAT00YHH5RRFHNNKSH16P. Like a UUID it is unique without a central authority, but it has two properties that UUID v4 lacks: it is sortable by creation time, and it is shorter and friendlier to read, copy and put in a URL. The format is defined in the ULID specification.
A ULID has two parts. The first 10 characters encode a 48-bit timestamp in milliseconds since the Unix epoch, and the last 16 characters are 80 bits of randomness. The characters come from Crockford's base32 alphabet (0123456789ABCDEFGHJKMNPQRSTVWXYZ), which leaves out I, L, O and U to avoid confusion and accidental words. Because the timestamp comes first, sorting ULIDs as plain strings sorts them by creation time, which keeps database indexes tidy and makes the newest records easy to find. This tool generates ULIDs in the monotonic mode recommended by the spec: if several ids are made in the same millisecond, each one increments the random part of the previous one, so they still sort in the order they were created.
You can generate 1 to 100 ULIDs at once, copy them as plain lines or as a JSON array, switch to lowercase and inspect any ULID you paste to read when it was created. The generator runs in your browser with no network request. See the UUID generator for the standard UUID family, including time-ordered UUID v7.
How to generate and read a ULID
- Set the quantity, from 1 to 100.
- Choose the format: raw (one ULID per line) or JSON (an array).
- Turn on lowercase if your system prefers it. ULIDs are case-insensitive.
- Press refresh to make a new batch, then copy it.
- To read a ULID, paste it in the inspect field. If it is valid, the tool shows the creation time in UTC. If not, it says why: wrong length, forbidden letters or an invalid format.
Examples
Anatomy of a ULID
01ARZ3NDEKTSV4RRFFQ69G5FAV is the example in the specification. Its first 10 characters, 01ARZ3NDEK, are the timestamp and the last 16, TSV4RRFFQ69G5FAV, the randomness. Inspecting it shows it was created on 2016-07-30 at 23:54:10.259 UTC.
A batch from one millisecond
Three ULIDs made at the same moment, 1700000000000 ms (14 November 2023, 22:13:20 UTC), look like this and still sort in order:
01HF7YAT00YHH5RRFHNNKSH16P
01HF7YAT00YHH5RRFHNNKSH16Q
01HF7YAT00YHH5RRFHNNKSH16RThe timestamp part 01HF7YAT00 is the same and the random part increases by one each time.
JSON output
With the JSON format a batch is a pretty-printed array of strings, ready for fixtures or test data.
Why it starts with 0 or 1
The first character cannot be above 7 because 48 bits of time fit in 10 base32 characters; the largest timestamp is in the year 10889.
Common mistakes
- A ULID with forbidden letters. I, L, O and U are never used; the tool reports them when you inspect.
- A ULID with the wrong length. It must have exactly 26 characters; the tool says how many you typed.
- Using ULIDs as secrets. The timestamp is readable and the random part is not a token. For tokens use the token generator.
- Assuming strict global order. ULIDs from different machines are ordered by millisecond, not by true causal order.
- Comparing with UUID text. A ULID is 26 characters of base32; a UUID is 36 characters of hex with dashes. They represent the same 128 bits but are not interchangeable text.
- Exposing creation time unintentionally. If the creation moment must stay private, use a random UUID v4.
Frequently asked questions
What is the difference between ULID and UUID?
Both are 128-bit identifiers. ULID is sortable by time, uses base32 and has 26 characters; UUID v4 is random, uses hex and has 36 characters. UUID v7 is also time-ordered.
Is a ULID unique?
In practice yes: 80 random bits per millisecond make a collision extremely unlikely, and the monotonic mode avoids collisions within one process and millisecond.
Can I get the date from a ULID?
Yes, paste it into the inspect field to read the creation time.
Are ULIDs case-sensitive?
No. Uppercase is the canonical form, and lowercase is accepted.
How do I generate ULIDs in code?
See below.
How to generate ULIDs in code
JavaScript
import { ulid, decodeTime } from 'ulid'; // npm install ulid
const id = ulid();
console.log(id, new Date(decodeTime(id)).toISOString());Python
# pip install python-ulid
from ulid import ULID
print(ULID())Go
// go get github.com/oklog/ulid/v2
id := ulid.Make()
fmt.Println(id.String())