Free tools that run in your browser. Use any tool without an account.

Favourites Cart
Sign in
Join free

Nano ID Generator

  • Free
  • Runs in your browser
  • No account needed

Nano ID Generator makes cryptographically secure short IDs in your browser. For example, the default 21-character ID uses a 64-character alphabet and gives about 126 bits of entropy; about 1.3e18 IDs are needed for a 1% duplicate chance.

Nano IDs
Check your input
Alphabet size
-
IDs for a 1% chance of one duplicate
-
Runs in your browser. Your files and values are not sent to us. Report a problem
Advertisement

About the Nano ID Generator

This tool creates Nano IDs locally in your browser using the same secure method as the nanoid library. You pick length, count, and an alphabet preset or enter your own characters. The page shows the generated IDs, the alphabet size, and how many IDs you would need for a 1 percent chance of any duplicate. The generator uses the browser cryptographic random source crypto.getRandomValues and rejection sampling so each character is equally likely. Results update instantly as you type and nothing is uploaded to a server. Developers use this for short unique keys, public short links, or human friendly tokens where URL safety and high entropy matter. The output and collision estimate match the nanoid implementation and the standard birthday problem math.

How to use it

  1. 1Set Length to the number of characters per ID
  2. 2Set How many to the number of IDs to generate
  3. 3Choose Characters from presets or pick My own characters
  4. 4Copy IDs or share a link that reopens with your settings
Advertisement

Worked example

Input: Length = 21, How many = 1, Characters = URL-safe (A-Z a-z 0-9 _ -). Result: Alphabet size = 64. IDs for a 1% chance of one duplicate ≈ 1.3e18 IDs (calculated from the birthday rule).

How it works

Method used: Each character is picked with the browser cryptographic random source crypto.getRandomValues with rejection sampling, matching the nanoid library. Exact steps and formulas from the nanoid implementation: - safeByteCutoff = 256 - (256 % alphabet.length) - If alphabet length is a power of two, compute mask = (2 << (31 - Math.clz32((alphabetLen - 1) | 1))) - 1 and use alphabet[byte & mask]. - step = Math.ceil((1.6 * 256 * size) / safeByteCutoff) - Request getRandom(step) bytes from crypto.getRandomValues. - For each byte b in the buffer: - If b < safeByteCutoff then map index = b % alphabet.length (or b & mask) and append alphabet[index]. - Stop when id length == requested sizeReturn id. Collision estimate used: With A possible characters and length L there are A^L possible IDsBy the birthday rule you need about sqrt(2 * A^L * ln(1 / 0.99)) IDs for a 1% chance that two match

Source: nanoid GitHub repository (README and implementation)nanoid implementation (index.js) showing safeByteCutoff and stepNano ID collision calculator (for reference). Last checked 6 November 2026.

What it is good for

  • Runs fully in your browser with crypto.getRandomValues
  • Shows alphabet size and 1% duplicate count instantly
  • Accepts presets or any custom character set
  • Generated IDs are local to your browser and not stored by FreeToolr
  • Collision estimate is probabilistic and should be treated as an estimate
Advertisement

Questions people ask

Is this generator cryptographically secure?

Yes. It uses the platform CSPRNG crypto.getRandomValues and the same rejection sampling method as the nanoid library. Do not use any nonsecure Math.random variant for secrets.

What are the default alphabet and length?

The default alphabet is the URL-safe set A-Z a-z 0-9 _ - which has 64 characters. The default length is 21 characters, which equals about 126 bits of entropy.

How do you compute the 1% duplicate estimate?

We use the birthday rule. With alphabet size A and length L there are A^L possible IDs. The approximate count for a 1% collision is sqrt(2 * A^L * ln(1 / 0.99)).

Does this tool send my IDs to a server?

No. All ID generation runs in your browser and nothing is uploaded by default. The share link encodes your settings, not the generated IDs.

Can I use custom characters?

Yes. Choose My own characters and type the set you want. The tool will compute the alphabet size and use the same rejection sampling method as nanoid.

Is Nano ID better than UUID v4?

They have similar collision resistance at common sizes. The default Nano ID (21 chars, 64 alphabet) gives about 126 bits compared to UUID v4's 122 bits, while using fewer characters and keeping the ID URL friendly.

Help keep every tool free

FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.

Advertisement
Advertisement