1

ULIDs (Universally Unique Lexicographically Sortable Identifiers) are unique identifiers designed for easy generation and chronological sorting. They consist of a 26-character string with an alphanumeric format, making them compact and human-readable. Unlike UUIDs, ULIDs start with a timestamp component, ensuring they can be sorted based on the time of creation, which is beneficial for databases and logs.


The time seed is the number of milliseconds since the Unix epoch (January 1, 1970) and occupies the first 48 bits of the ULID. This ensures natural chronological ordering. The maximum time seed value is 2^48-1, or about 8925 years, allowing ULIDs to be generated far into the future without running out of unique values.


Monotonic ULIDs solve the problem of generating multiple ULIDs in the same millisecond, which could lead to collisions. They achieve this by incrementing the least significant bits when multiple ULIDs are created simultaneously. This ensures that ULIDs remain unique and sortable even in high-concurrency situations, making them ideal for systems where the order of events is critical, such as logging and event sourcing.

Frequently asked questions

How is a ULID different from a UUID?

A ULID encodes the creation timestamp in its first 48 bits and is Base32-encoded, so ULIDs generated later always sort lexicographically after earlier ones — something plain UUIDs (except v6/v7) can't guarantee.

What does "monotonic" mean here?

Monotonic mode guarantees that ULIDs generated within the same millisecond in this session still sort in generation order, by incrementing the random portion instead of re-randomizing it.

Can I use ULIDs as database primary keys?

Yes — their time-ordering makes them friendly to B-tree indexes, avoiding the random-insert performance penalty that fully random UUIDs can cause.

Related tools

Self Signed Cert — Create self-signed x509 certificates
JWT Decoder — Decode JSON Web Tokens
Hash Generator — Generate MD5, SHA-1, SHA-256 hashes
URL Encoder — Percent-encode text or URLs

Guides & comparisons


Main page