ULID Generator

Generate a random Universally Unique Lexicographically Sortable Identifier (ULID). All operations are performed locally in your browser.

1
Note: ULID is a Universally Unique Lexicographically Sortable Identifier. Each click generates new random ULID(s).

About ULID

ULID (Universally Unique Lexicographically Sortable Identifier) is a 26-character string that combines a timestamp with random data. It provides a way to generate unique identifiers that are both time-ordered and URL-safe.

Key features of ULID:

  • Time-ordered: ULIDs are sortable by creation time
  • URL-safe: Contains only URL-safe characters
  • Case-insensitive: Can be safely used in case-insensitive contexts
  • Monotonically increasing: Each new ULID is guaranteed to be greater than the previous one

ULID Structure

A ULID consists of two parts:

ULID = [Timestamp (10 chars)] + [Randomness (16 chars)]

Where:
Timestamp = 48-bit timestamp in milliseconds
Randomness = 80-bit random number
ComponentSize (bits)CharactersPurpose
Timestamp4810Millisecond precision time ordering
Randomness8016Uniqueness guarantee

ULID Implementation in Different Languages

JavaScript:


import { ulid } from 'ulid';

// Generate a new ULID
const id = ulid();
// Example: '01ARZ3NDEKTSV4RRFFQ69G5FAV'
                

Python:


import ulid

# Generate a new ULID
id = ulid.new()
# Example: '01ARZ3NDEKTSV4RRFFQ69G5FAV'
                

Common ULID Use Cases

  • Database Primary Keys - Perfect for distributed databases where sorting by creation time is important
  • Event Tracking - Track events in chronological order with guaranteed uniqueness
  • Message Queues - Order messages while maintaining uniqueness
  • Cache Keys - Generate unique cache keys that are sortable by creation time
  • Session IDs - Create unique session identifiers that are URL-safe