ULID Generator
Generate sortable ULIDs with a timestamp component, and see how sorting works.
Configuration
Collision Probability
Generating 1 billion IDs
Time to 1% Risk
at 1,000 IDs/second
ULID Structure
ULID vs UUID
| ULID | UUID v4 | UUID v7 | |
|---|---|---|---|
| Length | 26 chars | 36 chars | 36 chars |
| Sortable | ✓ Yes | ✗ No | ✓ Yes |
| Timestamp | ✓ 48-bit ms | ✗ None | ✓ 48-bit ms |
| Case-sensitive | No (Crockford Base32) | No | No |
| Total entropy | 128 bits | 122 bits | 74 bits |
Features
- Generate Universally Unique Lexicographically Sortable Identifiers (ULIDs)
- Generate 1 to 10,000 ULIDs in a single operation with chunked rendering
- Color-coded breakdown of timestamp (10 chars) vs random (16 chars)
- Sortability live demo — watch ULIDs generated with delays sort correctly as strings
- Collision probability and time-to-collision statistics
- Export as .txt or .json with decoded timestamps
- Comparison table: ULID vs UUID v4 vs UUID v7
Common Use Cases
- Database primary keys that need both uniqueness and chronological sort order
- Event IDs in event-sourced systems where ordering matters
- Distributed log entries that must merge correctly when sorted
- Cursor-based pagination where users can sort by ID and get correct ordering
- Audit trail records that need creation time embedded without a separate column
What is a ULID?
A ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier with two components:
- Timestamp (48 bits): Unix time in milliseconds, encoded in the first 10 Crockford Base32 characters
- Randomness (80 bits): Cryptographically secure random data in the remaining 16 characters
The result is a 26-character, case-insensitive string that sorts correctly as a plain string comparison — no special date parsing needed. ULIDs generated in the same millisecond are monotonically incremented to preserve ordering.
Crockford Base32 uses a 32-character alphabet that excludes visually ambiguous characters (I, L, O, U), making ULIDs human-readable and safe to use in URLs without encoding.
Examples
01ARZ3NDEKTSV4RRFFQ69G5FAV01ARZ3NDEKTSV4RRFFQ69G5FAVFrequently Asked Questions
Both are timestamp-prefixed, but they differ in encoding and alphabet. UUID v7 uses hexadecimal (base-16) with hyphens and has 74 bits of randomness. ULID uses Crockford Base32 (base-32) without hyphens, resulting in a shorter 26-character string with 80 bits of randomness. ULIDs are slightly shorter and use a more human-friendly alphabet. UUIDs are more widely supported in databases and libraries.
Yes, as long as they are compared as strings (lexicographic order) and no two ULIDs are generated in the same millisecond by independent systems. Within the same millisecond from one source, the monotonic increment ensures ordering. Across distributed systems sharing the same millisecond, ordering is probabilistic — but extremely unlikely to collide.
Yes. The first 10 characters are the Crockford Base32 encoding of the Unix timestamp in milliseconds. This tool displays the decoded timestamp next to each ULID in the results. In code, use the decodeTime(ulid) function from the ulid library to get the milliseconds since the Unix epoch.
Yes. The Crockford Base32 alphabet uses only uppercase letters and digits (A–Z, 0–9), excluding I, L, O, and U to avoid visual ambiguity. This makes ULIDs safe for URLs, filesystems, and database identifiers without any encoding.
80 bits of randomness per ULID. At 1,000 IDs/second, you would need trillions of years to reach a 1% collision probability. Even in a distributed system generating 1 billion ULIDs total, the collision probability approaches zero.
💡 Tips
- Use ULIDs when you need sortable primary keys and don't want to couple to a specific database's native UUID type.
- The Sortability Demo shows the key feature of ULIDs visually — generate it and share the screenshot with stakeholders.
- ULIDs are always uppercase by spec, but most implementations accept lowercase input for comparison.
- For pagination cursors, ULIDs are ideal — sort your records by ULID and use the last ULID as a cursor; no separate <code>created_at</code> column required.
- If your database supports UUID natively, UUID v7 may be a better choice for broader ecosystem compatibility; otherwise, ULID is an excellent alternative.