What a ULID is
A ULID (Universally Unique Lexicographically Sortable Identifier) packs a 48-bit millisecond timestamp and 80 random bits into 26 characters of Crockford Base32, like 01HZX3K8J5QW2N7RT9VBMC4D6F. Sorted as plain text, ULIDs come out in creation order, which makes them handy for log entries, event IDs and database keys.
Crockford Base32 leaves out I, L, O and U, so ULIDs are easy to read and hard to mistype.
ULID or UUID v7?
Both are 128-bit, time-ordered IDs. Pick UUID v7 if your database or framework has a native UUID type. Pick ULID when you want shorter, URL-friendly strings that sort as text.
Frequently asked questions
Are ULIDs unique?
With 80 random bits, two ULIDs created in the same millisecond almost never collide. The specification also describes a monotonic mode for strict ordering within a millisecond, which this generator does not use.
Is the timestamp visible?
Yes. The first 10 characters encode the creation time, so avoid ULIDs where that would leak information.