Numbers

ULID Generator

A ULID (Universally Unique Lexicographically Sortable Identifier) is a modern alternative to UUID that combines a timestamp and random component into a 26-character string. Unlike UUIDs, ULIDs are sortable by creation time, making them ideal for database primary keys where ordering matters. They use Crockford Base32 encoding, which avoids ambiguous characters and is URL-safe. Use ULIDs wherever you need unique IDs that are also naturally ordered by time — perfect for logs, events, and distributed systems.

Use Cases

  • Time-ordered database primary keys
  • Distributed system event IDs
  • Log entry identifiers
  • URL-safe unique tokens
  • Replacing UUIDs where sort order matters

FAQ

What is a ULID and how is it different from UUID?

A ULID is a 26-character ID that encodes a timestamp plus randomness, making it lexicographically sortable by creation time. UUIDs are not sortable.

Are ULIDs URL safe?

Yes — ULIDs use Crockford Base32 encoding, which produces only alphanumeric characters safe for URLs and filenames.

Can I use ULIDs as database primary keys?

Yes, and they are often preferred over UUIDs because their time-based prefix reduces index fragmentation in databases like PostgreSQL and MySQL.

How unique are ULIDs?

Each ULID has 80 bits of randomness per millisecond, making collisions astronomically unlikely in practice.