What Is a ULID?
ULID stands for Universally Unique Lexicographically Sortable Identifier. It's a 128-bit identifier encoded as a 26-character Crockford Base32 string, designed to be:
- Lexicographically sortable — ULIDs generated sequentially sort correctly by creation time.
- Case insensitive — the Crockford Base32 encoding is case-insensitive and avoids ambiguous characters (I, L, O, U).
- URL safe — contains only alphanumeric characters, no special characters.
- Unique — 80 bits of randomness (in addition to the 48-bit timestamp) ensures collision resistance.
ULID Structure
01ARZ3NDEKTSV4RRFFQ69G5FAV
| Timestamp (10 chars) | Randomness (16 chars) |
01ARZ3NDEK TSVM4RRFFQ69G5FAV
Timestamp: 48 bits, millisecond precision (until year 10895)
Randomness: 80 bits of cryptographically secure random data
How to Generate ULIDs Online
- Open the ULID generator at DevKits.
- Click Generate to create a ULID for the current timestamp.
- Or specify a custom timestamp to generate a ULID for a specific point in time.
- Generate multiple ULIDs to see how they sort — each successive ULID will be lexicographically greater.
- Decode a ULID by pasting it in to extract the timestamp and randomness components.
Key Features
- ULID generation — creates valid ULIDs for the current moment or any specified timestamp.
- ULID decoder — extracts the millisecond timestamp and random component from any ULID.
- Batch generation — generate sequential ULIDs to verify sortability.
- UUID comparison — side-by-side comparison of ULID and UUID v4 for the same moment.
- Code examples — shows implementation code for major languages.
ULID vs UUID: When to Use Each
The critical difference is sortability. UUID v4 is fully random and has no inherent ordering. ULIDs embed a millisecond timestamp, so they sort chronologically by creation time.
Choose ULID when:
- You want database records to be stored in approximate insertion order (benefits B-tree index performance).
- You need to derive approximate creation time from the ID alone without a separate
created_atcolumn. - You're building event sourcing or audit log systems where chronological ordering matters.
- You want IDs that are URL-safe and case-insensitive.
Choose UUID when:
- You need maximum privacy — ULIDs leak approximate creation timestamp.
- You're using a framework or database that has native UUID support (PostgreSQL, MySQL 8.x).
- You need strict compliance with the UUID specification (RFC 4122).
ULID in Databases
ULIDs store well in databases. As a string, they fit in a VARCHAR(26) or CHAR(26) column. Alternatively, they can be stored as a 16-byte binary value (same as UUID) for better index performance. Because ULIDs sort in insertion order, they cause less B-tree fragmentation than random UUIDs, improving write performance in large tables.
aiforeverthing.com — Generate sortable unique IDs, no signup
Frequently Asked Questions
Are ULIDs truly unique?
Yes. With 80 bits of randomness in the random component, generating 1 trillion ULIDs per millisecond would give a collision probability of approximately 0.0000000001%. In practice, ULIDs are effectively unique for any real-world application.
Can I extract the creation time from a ULID?
Yes. The first 10 characters encode a 48-bit Unix timestamp in milliseconds. You can decode these characters to get the exact millisecond when the ULID was generated. The ULID decoder in the tool does this automatically.
Is ULID compatible with UUID?
ULIDs are 128 bits, the same as UUIDs. They can be converted to the UUID string format (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) and back. Some libraries offer this conversion for databases with UUID-typed columns.
Does the online generator work the same as the ulid npm package?
Yes, the algorithm is identical. For production use, install the appropriate ULID library for your language. The online tool is useful for testing and inspection.
Is the tool free?
Yes, completely free. ULIDs are generated client-side in your browser.
Recommended Hosting for Developers
- Hostinger — From $2.99/mo. Excellent for static sites and Node.js apps.
- DigitalOcean — $200 free credit for new accounts. Best for scalable backends.
- Namecheap — Budget-friendly shared hosting with free domain.