Generate short, URL-safe, collision-resistant identifiers
A Nano ID is 21 characters and carries 126 bits of entropy, which is shorter than a UUID for the same security and safer to put in a URL. This generator lets you pick the alphabet and the length.
- Default length
- 21 characters
- Alphabet
- Customisable
- Entropy
- crypto.getRandomValues
How to use it
- Set the length The default is 21 characters. Shorter ids are easier to share and read; each additional character multiplies the number of possible values by the alphabet size.
- Choose the alphabet The default is URL-safe letters and digits. You can remove characters that cause trouble in your context, such as 0 and O, or restrict the set to digits only.
- Generate and copy Generate a batch, copy the list, and use them as ids, filenames or share links.
Questions people ask
How does a Nano ID differ from a UUID?
A Nano ID is a short random string from a chosen alphabet, usually 21 characters, where a UUID is a fixed 36-character format with structure. A Nano ID is shorter and, with a custom alphabet, easier to type.
Are these ids random or sequential?
Fully random. They come from crypto.getRandomValues, so they contain no timestamp and no counter. For time-ordered ids, use a v7 UUID instead.
Which characters should I exclude?
It depends on where the id travels. In a spoken or transcribed context, exclude characters that look alike such as 0, O, 1 and l. In a URL, the default alphabet is already safe.
Can I use these as secrets?
For a session identifier, yes. For a credential, use a dedicated random secret generator, because an id that appears in a URL is routinely logged, stored in a referrer header and shared.
How many characters do I need?
Ten characters over the default alphabet give about 60 bits, which is plenty for identifiers. Twenty-one gives 126 bits. If the id is a secret, generate more.
Does it run offline?
Yes. Once the page has loaded, the generation works with no network access at all.
Reference
Length and the space it covers
| Length | Default alphabet | Possible values |
|---|---|---|
| `10` | `A-Za-z0-9_-` | `~8.4 × 10¹⁸` |
| `21` | `A-Za-z0-9_-` | `~2.7 × 10³¹` |
| `32` | `A-Za-z0-9_-` | `~8.6 × 10⁴⁴` |
Details that catch people out
A 21-character id over a 64-character alphabet gives 126 bits, which is more than enough that a collision is impossible in practice even across billions of ids. Ten characters gives 60 bits, which is fine for a session id but not for a secret that must never be guessed.
Guides that go deeper
- UUIDs, ULIDs and Snowflake IDs 9 min read · How to choose an identifier: random UUIDv4, time-ordered UUIDv7, ULID, Snowflake and…
Last reviewed 2026-10-06. Every tool on DevSnap runs entirely in your browser, so whatever you paste here never reaches a server.