Home/ Glossary/ ULID Generator
Tools

ULID Generator

The ULID generator creates Universally Unique Lexicographically Sortable Identifiers. ULIDs encode a 48-bit millisecond timestamp followed by 80 bits of randomness into a 26-character Crockford base32 string. Unlike UUIDs, ULIDs sort in creation order, making them well-suited for database primary keys where sequential ordering is desirable.

What is a ULID?

A ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier encoded as a 26-character uppercase Crockford base32 string. The first 10 characters encode the current Unix timestamp in milliseconds, and the remaining 16 characters encode 80 bits of cryptographic randomness. This structure guarantees that ULIDs generated in the same millisecond are still unique and that ULIDs generated at different times sort lexicographically in chronological order. They are compatible with UUID storage columns (128 bits) but more human-readable and database-friendly.

How does it work?

Click Generate to produce a new ULID using the current timestamp and cryptographically secure random bytes from the browser's crypto API. The tool decodes the generated ULID to display its timestamp component (the creation time) and the random component. You can generate multiple ULIDs at once for batch insertion into a database. The Crockford base32 alphabet is used instead of standard base32 to avoid visually ambiguous characters (I, L, O, U).

Typical Use Cases

  • Generating primary keys for database records that need time-ordered sorting
  • Creating unique correlation IDs for distributed system trace logs
  • Producing sortable unique identifiers for event sourcing or CQRS systems
  • Replacing UUID primary keys in tables that need chronological scan order

Step-by-step Guide

  1. Step 1: Click Generate to create a new ULID.
  2. Step 2: Optionally set the number of ULIDs to generate in a batch.
  3. Step 3: Inspect the decoded timestamp to verify the creation time.
  4. Step 4: Copy the ULID(s) for use in your application or database.

Example

Input
Generate 1 ULID
Output
01HQZ8KFAG3N7XPQR2DVCM5T6E (timestamp: 2024-02-28T10:23:45.123Z)

Tips & Notes

  • Store ULIDs as CHAR(26) in SQL databases or as a 16-byte binary blob for storage efficiency.
  • ULIDs generated within the same millisecond are still unique due to the 80-bit random component, but their relative order is not guaranteed.
  • Use ULIDs instead of auto-increment integers when you need globally unique IDs across multiple database instances.

Frequently Asked Questions

How is ULID different from UUID?
UUID v4 is purely random with no temporal ordering, making it inefficient for B-tree database indexes. ULID embeds a millisecond timestamp, so records sort naturally in creation order. ULIDs are also 26 characters versus UUID's 36 characters (with hyphens).
Is ULID collision-safe?
Yes. With 80 bits of randomness per millisecond, the probability of two ULIDs generated at the same millisecond colliding is astronomically small — about 1 in 2^80 (1.2 × 10^24).
ULID Generator
Generate Universally Unique Lexicographically Sortable Identifiers (ULIDs) — 128-bit IDs in Crockford Base32, lexicographically sortable, with timestamp decoding.
Open Tool