About the ULID & NanoID Generator
This tool generates two popular modern ID formats. A ULID (Universally Unique Lexicographically Sortable Identifier) is 128 bits written as 26 Crockford base32 characters: a 48-bit millisecond timestamp followed by 80 random bits. Because the time comes first, ULIDs sort in creation order as plain strings, which keeps database indexes tidy and makes logs easy to scan. A NanoID is a short random string — 21 URL-safe characters by default, with about the same collision resistance as a UUID v4 — that is popular for public IDs, slugs and short links.
Choose how many to create, embed a specific timestamp in ULIDs or use the current time, and switch on monotonic mode so that ULIDs created in the same millisecond still sort in order. For NanoIDs you can change the length and alphabet and the tool reports how many bits of entropy each ID carries.
Paste any ULID into the decoder to read the date and time it was created. Everything runs in your browser using the Web Crypto random generator; add a seed only when you need repeatable test data.
How to use the ulid & nanoid generator
- 1Choose ULID for sortable database keys or NanoID for short random IDs.
- 2Set how many IDs you need.
- 3For ULIDs, optionally enter a timestamp; for NanoIDs, choose the length and alphabet.
- 4Copy the list with the copy button.
- 5Paste an existing ULID into the decoder to see when it was created.
Formula and method
A ULID packs the Unix time in milliseconds into its first 48 bits and fills the remaining 80 bits with cryptographically random data. The 128 bits are written in Crockford base32 (digits plus 22 letters, without I, L, O and U), giving 10 time characters and 16 random characters. Because every character has the same weight in both the number and the string, sorting the text sorts by time. In monotonic mode, an ID created in the same millisecond as the previous one reuses its random part plus one.
A NanoID picks L characters uniformly from an alphabet of A symbols, using a bit mask and rejection sampling so no symbol is favoured. Each ID then carries L × log₂(A) bits of entropy — 21 × 6 = 126 bits for the default — and the birthday bound √(2 × 2^bits × ln(1/(1−p))) estimates how many IDs give a collision probability p.
- L
- NanoID length in characters
- A
- Alphabet size
- p
- Acceptable collision probability
Worked examples
Five ULIDs for a new table
Each ULID is 26 characters: 10 for the millisecond timestamp and 16 for 80 bits of randomness. With monotonic mode on, the five IDs are in strictly ascending order.
ULIDs stamped at New Year 2026
1 January 2026 00:00 UTC is 1,767,225,600,000 ms since 1970. Written as 10 Crockford base32 digits that is 01KDVDNA00, so every generated ID starts with those characters.
Default NanoIDs
Twenty-one characters from a 64-symbol alphabet give 21 × log₂(64) = 126 random bits — slightly more than the 122 random bits in a UUID v4, in a 21-character string.
Short numeric codes
Eight decimal digits carry 8 × log₂(10) ≈ 26.6 bits — only 100 million possibilities, so a 1% collision chance arrives after roughly 1,400 codes. Use these only for short-lived codes.
Decode the ULID spec example
The first 10 characters, 01ARZ3NDEK, decode from base32 to 1,469,922,850,259 milliseconds since the Unix epoch, which is 30 July 2016 at 23:54:10.259 UTC.
Frequently asked questions
What is the difference between a ULID and a UUID?+
Both are 128 bits. A ULID is written as 26 base32 characters and starts with a timestamp, so it sorts by creation time; a random UUID v4 is 36 hex characters with hyphens and has no order. UUID v7 offers similar time ordering in UUID format.
Can I extract the creation time from a ULID?+
Yes. The first 10 characters are the Unix time in milliseconds in Crockford base32. Paste the ULID into the decoder to get the exact UTC date and time — so do not use ULIDs where creation time should stay private.
How long should a NanoID be?+
The default of 21 URL-safe characters gives 126 bits of entropy, comparable to a UUID. Shorter IDs are fine for low volumes: 12 characters (72 bits) needs nearly 10 billion IDs to reach a 1% collision chance.
Are ULIDs and NanoIDs URL-safe?+
Yes. ULIDs use only digits and uppercase letters, and the default NanoID alphabet uses A–Z, a–z, 0–9, underscore and hyphen, so both can be placed in URLs and file names without escaping.
What does monotonic ULID generation mean?+
When several ULIDs are created in the same millisecond, a monotonic generator increments the previous random part by one instead of drawing new random bits. That guarantees the IDs sort in the exact order they were created.