What is a ULID?
A ULID (Universally Unique Lexicographically Sortable Identifier) is a 26-character ID that encodes a timestamp followed by randomness. Unlike a random UUID, ULIDs sort in the order they were created, which makes them friendlier for database indexes and logs while still being globally unique.
Example
A ULID looks like 01ARZ3NDEKTSV4RRFFQ69G5FAV. The first 10 characters are the millisecond timestamp; the last 16 are random. Generate several and you'll see they sort chronologically.
ULID vs. UUID
- ULID — sortable by creation time, 26 chars, URL-safe Crockford Base32.
- UUID v4 — fully random, 36 chars, not time-ordered.
How it's generated
The random portion uses crypto.getRandomValues, a cryptographically secure source. The timestamp uses your device clock.