Nano ID Generator & Collision Calculator
Generate Nano IDs with the same secure mask-and-reject method as the nanoid library: presets or custom alphabets, any size, plus a collision-probability calculator.
Nano ID is a popular compact alternative to UUIDs: by default 21 URL-safe characters carrying 126 random bits, a little more than a random UUID’s 122. This generator makes Nano IDs in the browser with the same algorithm as the nanoid library — secure random bytes, a bit mask and rejection of out-of-range values — with preset or custom alphabets and any length, and estimates how long it would take before two IDs collide.
How to use this tool
- Pick an alphabet preset or type your own (no repeated characters).
- Set the ID length and how many IDs you need.
- Enter how many IDs your system creates per hour to see the collision estimate.
- Copy the IDs; generate a fresh batch any time.
Formula
entropy = size × log₂(alphabet) IDs for 1% collision ≈ √(2 · alphabetˢⁱᶻᵉ · ln(1/0.99))
For each character a random byte is ANDed with mask = 2ᵏ − 1, the smallest such number ≥ alphabet length − 1; if the result is outside the alphabet the byte is discarded. This avoids the bias of byte mod alphabet. The collision estimate is the birthday approximation; time = IDs needed ÷ IDs per hour.
Example
With the default 64-symbol alphabet and 21 characters there are 2¹²⁶ possible IDs. About √(2 · 2¹²⁶ · 0.01005) ≈ 1.31 × 10¹⁸ IDs are needed for a 1% chance of any collision — at 1,000 IDs per hour, roughly 149 billion years. Shortening to 10 characters of 0–9 and a–z drops that to about 8.6 million IDs, or 357 days.
Frequently asked questions
Is a Nano ID as unique as a UUID?
The default 21-character Nano ID has 126 random bits, slightly more than a UUID v4 (122 bits), so the collision risk is comparable and negligible in practice.
Can I use a shorter or custom alphabet?
Yes, but entropy falls with each character removed. Use the calculator: if the time to a 1% collision is shorter than your system’s lifetime, increase the length.
Why not just use Math.random?
Math.random is not cryptographically secure and can be predicted. This page uses crypto.getRandomValues, like the nanoid library, so IDs cannot be guessed from earlier ones.
Sources
Last updated:
Page address with these inputs: https://kakao.mobile/tools/nanoid-generator/
Cite or embed this tool
kakaoCalc. (2026, November 8). Nano ID Generator & Collision Calculator. https://kakao.mobile/tools/nanoid-generator/
“Nano ID Generator & Collision Calculator.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/nanoid-generator/.
Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms