ULID Generator
Universally Unique Lexicographically Sortable Identifiers — like UUIDs, but time-ordered and more database-friendly.
Click Generate to create ULIDs
- Time Chars (1–10)
- Random Chars (11–26)
- UTC
- Unix ms
What is a ULID?
A ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier encoded as 26 Crockford Base32 characters. The first 10 characters encode a 48-bit millisecond timestamp, and the last 16 encode 80 random bits. This makes ULIDs naturally sortable by creation time.
ULID vs UUID
Unlike UUID v4, ULIDs are lexicographically sortable — newer IDs always sort after older ones. This improves B-tree index performance in databases and makes IDs human-interpretable. ULIDs also use a more compact Base32 encoding without hyphens.
Monotonic Mode
In monotonic mode, ULIDs generated in the same millisecond are guaranteed to be in ascending order — the random portion is incremented by 1. This is critical for distributed systems where multiple IDs must maintain strict ordering within a single timestamp.
Frequently Asked Questions
Everything you need to know about ULIDs
A ULID is a 128-bit identifier encoded as a 26-character Crockford Base32 string (e.g. 01ARZ3NDEKTSV4RRFFQ69G5FAV). The first 10 characters represent a 48-bit timestamp in milliseconds since Unix epoch (good until the year 10889). The remaining 16 characters are 80 bits of cryptographically random data. This gives over 1.208 × 10^24 possible values per millisecond.
Both are 128-bit unique identifiers, but with key differences. ULIDs are lexicographically sortable by generation time, which improves database index performance significantly. They use Crockford Base32 (no hyphens, case-insensitive), making them 26 characters vs UUID's 36. UUIDs have a slightly higher entropy per character but are not sortable by default. For most database use cases, ULIDs are the better choice.
In normal mode, ULIDs in the same millisecond may not sort correctly because they have independent random portions. Monotonic mode solves this: the random portion is incremented by 1 for each ULID generated within the same millisecond, guaranteeing strict ascending order within a batch. Use monotonic mode whenever you need absolute sort guarantees for high-throughput ID generation.
Yes. The first 10 characters of a ULID encode a 48-bit Unix timestamp in milliseconds. To decode it, interpret each character using Crockford Base32 (alphabet: 0123456789ABCDEFGHJKMNPQRSTVWXYZ) and multiply out positionally in base 32. The ULID Decoder section of this tool does this automatically and shows you the exact creation timestamp in UTC and local time.
Yes, ULIDs are an excellent choice for primary keys. Their lexicographic sortability means sequential inserts maintain B-tree locality, unlike random UUID v4 which causes page fragmentation and performance issues. Many production systems use ULIDs as primary keys in PostgreSQL, MySQL, and other databases. The 80-bit random portion makes collisions practically impossible even at very high generation rates.