ULID & NanoID generator
Time-ordered ULIDs and URL-safe NanoIDs in this tab. Nothing is uploaded.
Ready
How it works
A ULID is 26 Crockford Base32 characters: 10 encode the Unix time in milliseconds (48 bits), 16 encode 80 bits of randomness. Lexicographic order matches creation time, so they sort as primary keys without a UUID-style dash layout.
A NanoID is a compact random string. This page uses the 64-character URL-safe alphabet A–Za–z0–9_- and crypto.getRandomValues. Default length is 21 (same collision space as UUID, shorter on the wire).
Both run only in your browser. Refresh or go offline after load — generation still works.
Examples
Postgres-style ULID primary key (sortable inserts):
CREATE TABLE events ( id CHAR(26) PRIMARY KEY, payload JSONB ); -- insert a generated ULID as id
Public slug with NanoID (no + / / from Base64):
const url = "https://example.com/s/" + nanoid(); // e.g. /s/V1StGXR8_Z5jdHi6B-myT
When to pick which: ULID if you need time order in the ID (logs, event stores). NanoID if the ID will sit in a URL or filename. UUID v7 if you must stay in UUID form — use the UUID v7 generator.
FAQ
Is a ULID a UUID? No. Same 128-bit size, different encoding and layout. ULID is Base32 and always time-prefixed. UUID v7 is hex-with-hyphens and also time-prefixed.
Can ULIDs collide? Same millisecond + same 80 random bits. For a single generator that is effectively unused. Two machines in the same ms are still 80 bits of random apart.
Why Crockford Base32? It drops I, L, O, U to reduce transcription errors. ULID is case-insensitive; this page emits uppercase.
Is NanoID URL-safe? Yes with this alphabet. It will not need encodeURIComponent in a path segment.
Does this send IDs to a server? No. Randomness comes from crypto.getRandomValues in this page.
What length should I use for NanoID? 21 is the usual default. Shorter IDs collide sooner; this page allows 4–64.