Developer Tools
NanoID Generator
Generate up to 1,000 Nano IDs at once from a cryptographic random source. Set length, prefix and alphabet, and see the bits of randomness and collision odds.
How to use NanoID Generator
Set the length, how many IDs you need and the alphabet, and add an optional prefix such as user_. A fresh batch is generated whenever you change a setting, with an estimate of how many IDs it would take to risk a duplicate.
- Set length and countThe default is 21 characters, as in the nanoid library; choose 1 to 256 characters and up to 1,000 IDs.
- Pick an alphabetUse URL-safe (64), letters and digits, lower case, no look-alikes, hex, digits only, or your own characters.
- Add a prefix and copyAdd a prefix such as ord_ for readable IDs, then copy the list, which has one ID per line.
Length, alphabet and collision risk
The default URL-safe alphabet has 64 characters (A–Z, a–z, 0–9, _ and -), so a 21-character ID carries about 126 bits of randomness and you would need roughly 1.3 × 10^18 IDs for a 1% chance of a duplicate. Smaller alphabets need longer IDs: 10 digits give only about 33 bits, and a duplicate becomes 1% likely after roughly 14,178 IDs. The estimate updates with every change, and anything under 64 bits is flagged as unsuitable for public unique IDs. The no-look-alikes set drops characters such as 0, O, 1, l and I for IDs that people have to read or type.
Why there is no modulo bias
Mapping a random number onto an alphabet with the remainder operator makes some characters slightly more likely whenever the alphabet size does not divide the random range evenly. This generator uses rejection sampling instead: random values that fall outside the largest even multiple are thrown away and drawn again, so every character is equally likely with any alphabet size, including custom ones. Random numbers come from the browser's crypto.getRandomValues, and duplicate characters in a custom alphabet are removed before generating.
Accuracy and data handling
Validate the result with your project's own tests and runtime rules before using it in production. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
What is the difference between Nano ID and UUID?
A version 4 UUID is 36 characters with 122 random bits. A default Nano ID is 21 URL-safe characters with about 126 bits, so it is shorter with similar collision resistance.
Can I generate numeric-only IDs?
Yes, choose Digits only. Each digit adds only about 3.3 bits, so make them longer: 10 digits give about 33 bits, fine for internal references but not for unguessable tokens.
Will the IDs ever repeat?
In theory yes, but at the default settings the chance is negligible. The estimate under the list shows how many IDs you could create before a duplicate reaches a 1% chance.
More Developer Tools
Related toolsCreate time-sortable ULIDs in bulk, for now or for a chosen time
Sign test JWTs with HS256, HS384 or HS512 and automatic iat and exp
Run XPath queries on XML or HTML and list every matching node
Preview the next runs of a cron expression with a plain-English summary
Convert Linux file permissions between 755 and rwxr-xr-x, with chmod commands
Validate UUIDs, detect the version and decode v1, v6 and v7 timestamps