What is a Nano ID?
A Nano ID is a short random identifier, by default 21 characters drawn from letters, digits, underscore and hyphen. It's a popular alternative to UUIDs for public URLs, database keys and tokens, because it's compact and needs no escaping in URLs or file names.
Choose a preset alphabet or type your own, set the length, number of IDs and an optional prefix, and generate. Alongside the IDs you'll see the alphabet size, the bits of randomness, how many IDs give a 1% chance of a duplicate, and how long that takes at 1,000 new IDs an hour.
How to use the Nano ID generator
1.Choose an alphabet and length
21 URL-safe characters is the standard.
2.Add a prefix if you like
Like usr_ or inv_ to show what an ID is for.
3.Generate and copy
Up to 1,000 IDs, downloadable as text.
Example: the default settings
21 characters from the 64-character URL-safe alphabet:
- Randomness
- 126 bits
- IDs for a 1% clash chance
- about 1,308 quadrillion
- At 1,000 IDs an hour
- about 149 billion years
n ≈ √(2 · ln(1/0.99)) × 2^(bits ÷ 2)
For almost any app, a clash is never going to happen in practice.
Random enough, and unbiased
IDs come from your browser's cryptographic random generator. Each random byte is masked to the nearest power of two and values outside the alphabet are thrown away, so every character is equally likely; simply using the remainder would favour some characters.
Collision odds use the birthday bound: the number of IDs at which there's a 1% chance any two match. The default 21 URL-safe characters carry 126 bits, slightly more than a UUID v4, in 21 characters instead of 36.
Frequently asked questions
Nano ID or UUID?
Nano IDs are shorter and URL-safe; UUIDs are a standard many databases understand natively.
Is a shorter length safe?
It depends on volume. The calculator shows when clashes become likely for your settings.
Why avoid look-alike characters?
For codes people read or type, like invite codes, so 0 and O can't be confused.
Are generated IDs stored?
No. They exist only on this page.
Related tools
UUID Generator
Random v4 and time-ordered v7 UUIDs, plus a UUID checker.
Random String Generator
Random strings from any character set: tokens, codes and test data.
Secret Key Generator
Random 128 to 512-bit keys as hex, Base64 and Base64URL.
Base64 Encoder & Decoder
Base64 and Base64url for text (UTF-8) and files.
URL Encoder & Decoder
Percent-encode or decode URLs and query values, and see a URL's parts.
JWT Decoder
Decode a JSON Web Token's header and payload and check its expiry.
More Developer tools
JSON & data
CSV tools
Network & system
Web & API
Git & releases
Encoding & security
Text & code
- Regex tester
- Text diff checker
- Cron expression explainer
- Lorem ipsum generator
- Markdown previewer
- Slug generator
- Strip HTML tags
- Unicode character inspector
- URL parser
- Markdown TOC generator
- cURL converter
- Whitespace visualizer
- Markdown link extractor
- Regex escape
- Regex match extractor
- Split text by regex
- HTML, CSS and JS playground
- Mock data generator
- Keyboard event tester
- ASCII table