Replace UUIDs in a database table with ULIDs to get time-ordered inserts that reduce index fragmentation.
Generate URL-safe, human-readable unique IDs without hyphens or special characters.
Use a community ULID library in Python, Rust, Go, or 40+ other languages to generate sortable unique IDs.
Ensure IDs generated within the same millisecond still sort in creation order using ULID monotonic mode.
This is a specification only, pick a community library in your language from the README list to generate ULIDs.
ULID stands for Universally Unique Lexicographically Sortable Identifier. This repository contains the official specification for the format, not a library itself. ULID is an alternative to UUID, the identifier format most software uses when it needs a unique ID for a database row, file, or other record. UUIDs have some practical downsides. They are 36 characters long and include hyphens, they carry no time information, and some versions require a unique network address (MAC address) that is not always available. ULID addresses these problems by packing the same 128 bits of data into a 26-character string that sorts correctly by time. Each ULID is made of two parts. The first 10 characters encode a 48-bit timestamp accurate to the millisecond. The last 16 characters hold 80 bits of random data. Because the timestamp comes first, ULIDs generated later always sort after earlier ones when sorted alphabetically. This is useful for databases where inserting records in time order reduces fragmentation and speeds up range queries. The character set used is Crockford's Base32, which omits the letters I, L, O, and U to avoid visual confusion when reading or typing IDs by hand. The result is case insensitive and safe to use in URLs without extra encoding. A monotonic mode ensures that even if multiple IDs are generated within the same millisecond, they still sort in creation order by incrementing the random portion with each call. The specification is designed to be implemented in any programming language. The README lists community-maintained implementations in over 40 languages, including Python, Rust, Go, Java, Ruby, PHP, Swift, Elixir, and many others.
← ulid on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.