ULID Generator

Universally Unique Lexicographically Sortable Identifier

Generating...

About

ULID (Universally Unique Lexicographically Sortable Identifier) is a 128-bit identifier that is both unique and sortable. It combines a 48-bit timestamp (milliseconds since Unix epoch) with 80 random bits. ULIDs are URL-safe, case-insensitive, and can be sorted chronologically using standard string sort, making them excellent for database primary keys. They're 26 characters long and use Crockford's Base32 encoding, which avoids ambiguous characters.

Use Cases

  • Database primary keys with chronological ordering
  • Time-ordered distributed systems
  • Event logging and audit trails
  • Sortable unique identifiers
  • Database indexes with time-based queries
  • Systems requiring both uniqueness and sortability

How to Generate

Library

ulid

NPM Package

npm install ulid

Code Example

import { ulid } from 'ulid';
const id = ulid();
console.log(id); // e.g., '01ARZ3NDEKTSV4RRFFQ69G5FAV'