ULID Generator

Generate sortable, time-prefixed unique identifiers.

Generate ULIDs — Universally Unique Lexicographically Sortable Identifiers — that combine a millisecond timestamp prefix with random suffix for collision-resistance. ULIDs sort naturally by creation time, which makes them great for event logs and Postgres B-tree indexes.

Common use cases

  • Use as primary keys when you want time-ordered inserts
  • Replace UUID v4 in event-sourcing and audit-log tables
  • Create human-friendlier IDs that fit in 26 base32 chars
  • Generate sort-stable IDs for Firestore or DynamoDB documents

Frequently asked questions

Why ULID instead of UUID?
ULIDs sort by creation time naturally because the first 48 bits are a millisecond timestamp. UUID v4 is fully random, which fragments database indexes.
How long are they?
26 characters in Crockford's base32 — slightly shorter than UUID's 36 characters and case-insensitive.
Are they unique?
Yes — 80 bits of randomness on top of the timestamp gives a vanishingly small collision probability even at millions of IDs per millisecond.

Related tools