Skip to content
DevToolKit

ULID Generator

Generate, decode, and compare ULIDs with monotonic ordering, anatomy view, time travel, and UUID conversion.

Was this tool helpful?

How to Use

Generate, decode, and compare ULIDs (Universally Unique Lexicographically Sortable Identifiers) entirely in your browser. All generation uses crypto.getRandomValues() for cryptographic randomness.

  1. Generate ULIDs by selecting a count and clicking Generate. Each ULID is monotonically increasing — IDs generated in the same millisecond are strictly ordered.
  2. Inspect the anatomy by clicking the chevron on any result. The tool shows the timestamp component (first 10 characters) decoded to its exact date, plus the random component, hex representation, and UUID-compatible format.
  3. Time travel by enabling the Time Travel button. Enter a past or future date to generate ULIDs with that timestamp — useful for testing sort order in databases.
  4. Decode existing ULIDs using the Decode tab. Paste a ULID to see its embedded timestamp and metadata. You can also convert UUIDs to ULID format.
  5. Compare formats using the Compare tab. See how ULID stacks up against UUID v4, UUID v7, NanoID, and Snowflake IDs across sortability, size, and timestamp features.

About This Tool

ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier that combines a 48-bit Unix millisecond timestamp with 80 bits of cryptographic randomness. Unlike UUID v4, ULIDs sort chronologically when ordered as strings, making them ideal for database primary keys, event logs, and distributed systems.

Structure: 26 Characters, 128 Bits

A ULID is encoded as 26 characters using Crockford's Base32 alphabet (0123456789ABCDEFGHJKMNPQRSTVWXYZ). The first 10 characters encode the Unix timestamp in milliseconds (48 bits), and the remaining 16 characters encode cryptographic randomness (80 bits). This gives 280 possible values per millisecond — roughly 1.2 × 1024 — making collisions practically impossible.

Monotonic Ordering

When multiple ULIDs are generated within the same millisecond, this tool uses a monotonic factory that increments the random component to ensure strict ordering. This means batch-generated ULIDs are always sortable, even at high throughput. The ULID specification requires this behavior for correctness in concurrent systems.

Crockford's Base32

Unlike standard Base32 (RFC 4648), Crockford's Base32 excludes the letters I, L, O, and U to avoid confusion with 1, 1, 0, and V. It also specifies that decoding should accept lowercase and treat I/L as 1, O as 0. This makes ULIDs resilient to human transcription errors — a ULID read aloud over the phone will decode correctly even with common character substitutions.

ULID vs UUID v7

UUID v7 (RFC 9562) was inspired by ULID and shares the same 48-bit timestamp prefix approach. The key differences: UUID v7 uses hex encoding with hyphens (36 characters), while ULID uses Crockford's Base32 (26 characters, 28% shorter). UUID v7 has version/variant bits that reduce entropy slightly. Both are lexicographically sortable and interchangeable at the binary level — this tool can convert between the two formats.

Why Use This Tool

ULIDs solve real problems that UUID v4 doesn't address. Here are the most common use cases:

  • Database primary keys — Random UUIDs cause B-tree index fragmentation because inserts land on random pages. ULIDs insert sequentially (like auto-increment) while remaining globally unique. PostgreSQL, MySQL, and MongoDB all benefit from ULID primary keys.
  • Event sourcing & logs — ULIDs encode their creation time, so events are inherently ordered without needing a separate timestamp column. The timestamp is extractable without a database lookup.
  • Distributed systems — Unlike auto-incrementing IDs, ULIDs can be generated independently on any node without coordination. The 80 bits of entropy per millisecond make collisions vanishingly unlikely.
  • API response ordering — Cursor-based pagination works naturally with ULIDs since they sort chronologically as strings. No need for created_at indexes or composite sorting.
  • Migration from UUID — ULIDs are binary-compatible with UUIDs (both are 128 bits). The Decode tab converts between formats, making migration straightforward.
  • Testing and debugging — The Time Travel feature generates ULIDs for arbitrary timestamps, useful for seeding test databases or debugging time-dependent logic.

Privacy

All ULID generation uses your browser's crypto.getRandomValues() API for the random component. No IDs are sent to any server. Generated ULIDs never leave your machine unless you copy them.

FAQ

What is a ULID?
ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier combining a 48-bit timestamp with 80 bits of randomness. ULIDs sort chronologically as strings.
How is ULID different from UUID?
ULIDs are 26 characters (shorter than UUID's 36), sort chronologically, and use Crockford's Base32. They are binary-compatible with UUID (both 128 bits).
Is my data sent to a server?
No. All generation uses your browser's crypto.getRandomValues() API. No IDs are transmitted anywhere.