NanoID generator

Make compact random identifiers the way the NanoID library does: pick an alphabet and a length, and get ids that are safe to use in URLs and file names. The tool shows how many bits of entropy each id carries.

IDs

0 symbols, about 0 bits of entropy per ID.

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. Choose a preset alphabet or type your own characters.
  2. Set the length and how many ids you need.
  3. Copy the result. Press Generate again for new ones.

How it works

For each position the tool reads random bytes from crypto.getRandomValues, masks them to the smallest power of two that covers the alphabet, and keeps the byte only if it points at a real symbol. The entropy is the length times log2 of the alphabet size: 21 × log2(64) = 126 bits.

Tips

  • Digits-only ids are short to type but weak: 10 digits are only about 33 bits.
  • A custom alphabet without look-alike characters (0/O, 1/l) is easier to read aloud.
  • Emoji in a custom alphabet count as one symbol each.

Frequently asked questions

Is this the same as the NanoID library?

It follows the same idea and the default URL-safe alphabet of 64 symbols with a default length of 21, but it is an independent implementation. Ids made here have the same format as ids from the library.

How long should an ID be?

It depends on how many ids you will make and how bad a collision is. Each symbol of a 64-symbol alphabet adds 6 bits, so 21 symbols give 126 bits, close to a random UUID's 122. The entropy line under the result tells you what your settings give.

Is the alphabet choice biased?

No. Random bytes that fall outside the alphabet are discarded instead of wrapped around with a remainder, so every symbol is equally likely even when the alphabet size is not a power of two.

Are repeated characters in a custom alphabet counted?

Duplicates are removed first, because they would make some symbols more likely. The stat line shows how many different symbols remain.

Can I use these as passwords or tokens?

They come from a cryptographically secure generator, so enough entropy makes a fine token. For passwords you type yourself, use the password generator instead, which is built for that.

More in Developer

All tools in this category: Developer ·Updated November 3, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.