About this tool
A ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit ID like 01JD3Z8K6W2Q5X7N9R4T0V1B8C. Its first 10 characters encode the creation time in milliseconds and the last 16 are random, so ULIDs are as unique as a UUID but sort by creation time as plain text. That makes them excellent primary keys: new rows land at the end of the index instead of at random places.
How to use it
- Choose how many ULIDs you need and click Generate (or press G).
- Keep Monotonic order on so IDs created in the same millisecond still sort in the order they were made.
- Paste any ULID into Decode a ULID to see its creation date and time.
ULID structure
01JD3Z8K6W 2Q5X7N9R4T0V1B8C
|----------| |----------------|
timestamp randomness
48 bits 80 bits
10 chars 16 chars
ULIDs use Crockford’s Base32 alphabet (0–9 and A–Z without I, L, O and U), so they are case-insensitive, contain no look-alike characters and are safe in URLs and file names. The timestamp runs out in the year 10889.
ULID vs UUID
| ULID | UUID v4 | UUID v7 | |
|---|---|---|---|
| Length as text | 26 characters | 36 characters | 36 characters |
| Sorts by time | Yes | No | Yes |
| Random bits | 80 | 122 | 62–74 |
| Native database type | Text, or convert to uuid | uuid | uuid |
If your database has a native UUID type, UUID v7 gives the same time ordering in a standard format. ULIDs win when you want shorter, friendlier IDs in URLs and logs.
ULIDs in code
// npm install ulid
import { ulid, monotonicFactory } from 'ulid';
ulid(); // 01JD3Z8K6W2Q5X7N9R4T0V1B8C
const next = monotonicFactory();
next(); next(); // strictly increasing, even in the same ms# pip install python-ulid
from ulid import ULID
uid = ULID()
str(uid) # '01JD3Z8K6W2Q5X7N9R4T0V1B8C'
uid.datetime # creation time as a datetime-- Store ULIDs as text (26 chars), or convert to uuid for a 16-byte column.
CREATE TABLE orders (
id char(26) PRIMARY KEY, -- sorts by creation time
...
);The creation time inside a ULID is readable by anyone who sees the ID. Don’t use ULIDs where revealing when a record was created matters.
FAQ
What is a ULID?
A 128-bit unique identifier written as 26 characters: a 48-bit millisecond timestamp followed by 80 random bits. ULIDs sort in creation order as plain text.
Is a ULID better than a UUID?
For database keys, a ULID’s time ordering keeps indexes compact and inserts fast, unlike UUID v4. UUID v7 offers the same benefit in standard UUID format.
Can I get the creation time from a ULID?
Yes. The first 10 characters are the timestamp. Paste a ULID into the decoder above to see it.
What does monotonic mean?
When several ULIDs are created in the same millisecond, the random part is incremented instead of re-drawn, so they still sort in creation order.
Are ULIDs case-sensitive?
No. Crockford Base32 treats upper and lower case the same; uppercase is the canonical form.