NanoID Generator

Generate NanoIDs at an adjustable length

Runs in your browserUtility04Generators

What is NanoID Generator?

NanoID produces short, URL-safe random identifiers. The default is 21 characters drawn from a 64-character alphabet, which works out to roughly 126 bits of entropy — the same league as UUID v4 but 15 characters shorter. IDs come from a cryptographic random source and are generated locally in your browser.

How to use NanoID Generator

  1. 1Set the length (the 21-character default is already secure enough).
  2. 2Set how many IDs to generate.
  3. 3Copy the results for short links, invite codes or temporary keys in the front end.

Frequently asked questions

Why is 21 characters enough?+

NanoID uses a 64-character alphabet, so each character carries 6 bits and 21 characters give about 126 bits of entropy — comparable to the 122 bits of a UUID v4. Even at a rate of one million IDs per hour, you would expect thousands of years to pass before a single collision.

Can I shorten a NanoID to 8 characters?+

Eight characters is about 48 bits of entropy, where collisions become likely enough to matter once the dataset grows, so you have to back it with a unique constraint in the database and retry on conflict. Only shorten the ID when a person has to type it and the total volume is bounded, such as a promo code.

Related tools

All tools