ULID & NanoID Generator

Generate batches of modern unique IDs — sortable ULIDs or URL-safe NanoIDs

Settings

26-character Crockford base32 ID with a 48-bit millisecond timestamp prefix. Lexicographically sortable.

Generated IDs

No IDs yet

Click Generate to create a batch

Examples

Generate 10 ULIDs for database rows

import { ulid } from "ulid"

const ids = Array.from({ length: 10 }, () => ulid())
// '01HXYZ4K8P0000000000000000'  ← sortable by creation time

ULIDs are 26 characters, lexicographically sortable, and safe to use as primary keys in databases that support string IDs.

NanoID with custom alphabet for readable tokens

import { customAlphabet } from "nanoid"

const nanoid = customAlphabet('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', 12)
const token = nanoid() // e.g. 'A3K9FZ2MQ8RT'

A custom alphabet of uppercase letters and digits produces human-readable tokens free of ambiguous characters, perfect for invite codes or short IDs.

Details

ULID (Universally Unique Lexicographically Sortable Identifier) encodes a 48-bit millisecond timestamp plus 80 random bits into 26 Crockford base32 characters. Unlike UUID v4, ULIDs sort chronologically by default, making them ideal for database primary keys. NanoID is a tiny, secure, URL-friendly unique string ID library. Its default 21-character output uses an alphabet of 64 URL-safe characters and provides a collision probability comparable to UUID v4. Both run entirely in your browser — no data leaves your device.

About this tool

ULID (Universally Unique Lexicographically Sortable Identifier) fixes a key shortcoming of UUID v4: random IDs produce random index keys that fragment database pages over time. A ULID encodes the current Unix time in milliseconds into the first 10 of its 26 Crockford base32 characters, then appends 80 random bits — making it monotonically sortable and collision-resistant with no coordination required.

NanoID is a compact, URL-safe alternative to UUID. Its 21-character default uses a 64-character alphabet drawn from the Web Crypto API, producing a collision probability on par with UUID v4 in a string 26% shorter. Both the alphabet and size are configurable: a numeric alphabet creates readable codes; a larger size increases entropy.

Both generators run entirely in your browser using crypto.getRandomValues for entropy, so generation is cryptographically secure and no data leaves your device. Use it to seed test fixtures, populate a local database, or compare the two formats before choosing one.

How to use

  1. Generate a batch of ULIDs

    Select the ULID tab, set the Count slider (1–100), and click Generate. Each ULID is 26 Crockford base32 characters with a timestamp prefix. Use 'Copy all' to copy the batch.

  2. Generate NanoIDs with a custom alphabet

    Select the NanoID tab, set the Size slider (4–36, default 21), and optionally enter a custom alphabet. Leave it blank for the default URL-safe alphabet, then Generate.

  3. Use the IDs in your code

    Install with pnpm add ulid or nanoid, then call ulid()/nanoid() at runtime — never during module init or React render, to avoid server/client mismatches.

ULID vs NanoID vs UUID

PropertyValue
ULID length26 chars (Crockford base32)
NanoID default length21 chars (URL-safe alphabet)
UUID v4 length36 chars incl. 4 dashes
ULID sortable?Yes — timestamp in most-significant bits
NanoID / UUID v4 sortable?No — fully random
NanoID default alphabetA–Z a–z 0–9 _ - (64 chars, URL-safe)

Frequently asked questions