URL-safe ULID generator
A ULID (Universally Unique Lexicographically Sortable Identifier) is a 26-character identifier designed as a friendlier alternative to the UUID. It combines a 48-bit millisecond timestamp with 80 bits of randomness and encodes the result in Crockford base32, producing IDs that sort by creation time, contain no hyphens, and are safe to drop straight into URLs, filenames and log lines.
Structure of a ULID
The 128 bits of a ULID are split into two parts:
- Timestamp (first 10 characters, 48 bits) — milliseconds since the Unix epoch. This gives coverage until the year 10889, so practical overflow is not a concern.
- Randomness (last 16 characters, 80 bits) — generated by the browser’s
crypto.getRandomValues, making collisions within the same millisecond statistically negligible (2^80 possible values).
The Crockford base32 alphabet is 0-9A-Z minus I, L, O and U — chosen specifically to avoid the visual ambiguity of those letters with 0 and 1. Because the encoding preserves byte order, sorting ULID strings alphabetically is equivalent to sorting by creation time.
| Property | Value |
|---|---|
| Total length | 26 characters |
| Timestamp bits | 48 (first 10 chars) |
| Random bits | 80 (last 16 chars) |
| Encoding | Crockford base32 |
| Case-sensitive | No |
| Max timestamp | Year 10889 |
How this generator works
When you click Generate, the tool reads the current time via Date.now() and draws 80 bits from crypto.getRandomValues. When generating a batch of more than one ULID, each subsequent ULID’s timestamp is incremented by one millisecond so the entire batch is strictly monotonic — no two IDs share a timestamp, which guarantees sort order even without looking at the random tail.
Lowercase output is the same underlying value; Crockford base32 is case-insensitive.
ULID vs UUID: choosing the right one
| Feature | ULID | UUID v4 | UUID v7 |
|---|---|---|---|
| Length | 26 chars | 36 chars (with hyphens) | 36 chars |
| Sortable | Yes (by time) | No | Yes (by time) |
| URL-safe | Yes (no hyphens) | Only after stripping hyphens | Only after stripping hyphens |
| Format | Crockford base32 string | Hex with hyphens | Hex with hyphens |
| Collision risk | Negligible | Negligible | Negligible |
Choose ULID when: you want sortable primary keys, compact identifiers in URLs, or log-line IDs that are human-readable and time-ordered.
Choose UUID when: you need compatibility with a library or database driver that expects the standard hyphenated hex format, or your team has existing UUID infrastructure.
UUID v7 has overlap with ULID — both are time-sortable — but UUID v7 keeps the familiar hex-with-hyphens shape at the cost of being slightly longer and less URL-friendly.
Using ULIDs as database primary keys
The time-sorted prefix makes ULIDs effective B-tree primary keys. Random UUIDs cause page splits on insert because each new key lands at a random position in the index. ULIDs always append near the end of the index (since timestamps increase monotonically), keeping insert performance more predictable and index fragmentation lower — similar to auto-increment integers but globally unique and without a single sequence bottleneck.
Generation happens entirely in your browser. The timestamp and random bits never leave your device.