Want a unique id that is shorter than a UUID but still hard to guess? The Nano ID Generator builds tiny, URL-friendly ids in your browser. You pick a length, an alphabet, and a count.
This tool suits developers who need keys for database rows, links, or files. It makes random strings from a chosen character set and estimates their collision risk.
Table of Contents
- What the Tool Does
- How to Use the Nano ID Generator
- How a Nano ID Is Built
- Worked Example
- How to Read the Results
- Length, Alphabet, and Collisions
- Limitations and Assumptions
- FAQs About the Nano ID Generator
What the Tool Does
The generator makes a list of random Nano IDs. A few controls set the shape, and three buttons handle the output.
- Nano ID Size: how many characters each id holds, from 4 to 128.
- Quantity: how many ids to make, from 1 to 1000.
- Alphabet Preset: the character set, with a custom option.
- Generate Nano IDs fills the box. Copy All and Download File save the list.
Four cards show the quantity, the id size, the alphabet size, and a collision estimate. Ids appear one per line in a read-only box.
How to Use the Nano ID Generator
- Set the Nano ID Size. The default is 21 characters.
- Set the Quantity from 1 to 1000. The default is 10.
- Pick an Alphabet Preset, or choose Custom to type your own.
- Press Generate Nano IDs to fill the box. Changing a setting also makes a fresh batch.
- Press Copy All or Download File to save the ids.
How a Nano ID Is Built
The tool picks random characters from your alphabet until the id reaches the chosen size. It uses a masking method that avoids bias toward any character.
Alphabet+Size=Nano ID
- The default alphabet is A to Z, a to z, 0 to 9, plus _ and -, for 64 characters.
- The default size is 21, which matches the standard Nano ID setup.
- Random bytes come from window.crypto.getRandomValues, a secure source.
- The masking step rejects out-of-range bytes, so each character is equally likely.
This rejection method is what the real Nano ID library uses. It avoids the small bias that a plain remainder step can cause.
Worked Example
Elena keeps the defaults: size 21, the URL-friendly alphabet, and quantity 10. The tool makes ten ids, one per line.
Each id holds 21 characters from a 64-character set. That gives about 126 bits of entropy per id.
| Setting | Value |
| Quantity | 10 |
| ID size | 21 chars |
| Alphabet size | 64 chars |
| Collision estimate | 41,465,643 Years |
An id looks like V1StGXR8_Z5jdHi6B-myT and changes on every run. The pool of 64 to the power of 21 is so large that a repeat is almost impossible.
How to Read the Results
Quantity and ID Size echo your inputs. Alphabet Size counts the unique characters in the active set.
Est. 1% Collision Risk is a rough guide. It now shows a real time for every setting, from seconds up to many years. Very large pools switch to short scientific notation.
Length, Alphabet, and Collisions
Length is the main lever for uniqueness. Each extra character multiplies the pool by the alphabet size. A 21-character id from 64 options is far safer than a short one.
The alphabet changes the look and the pool. Numbers-only ids are easy to read but need more length to stay unique. The unambiguous preset drops look-alike characters like 0, O, I, l, and 1.
Shorter ids save space but repeat sooner, so weigh size against your record count. For a classic 36-character id, use the UUID generator. For the Microsoft-style format, see the GUID generator.
If you need a high-entropy secret instead of an id, try the secure token generator. For free-form text, use the random string generator, and for large batches of ids, the UUID bulk generator helps. More tools sit in the developer tools hub.
Limitations and Assumptions
- The size is held from 4 to 128, and the quantity from 1 to 1000. Values outside those ranges are pulled back inside.
- A blank size falls back to 21, and a blank quantity to 10.
- The collision time is a rough birthday-bound estimate. Treat it as a guide, not an exact promise.
- A custom alphabet is de-duplicated. An empty or one-character custom set shows a message and makes no ids.
- Copy All shows a short Copied or Copy blocked note. Download saves a plain text file named nano-ids.txt.
- These ids are identifiers, not secrets. Do not use a short id where a long random token belongs.
FAQs About the Nano ID Generator
Is the Nano ID Generator secure?
Yes, it uses window.crypto.getRandomValues, a cryptographically secure source, with an unbiased masking step. Ids are built in your browser and never sent to a server. They are not stored anywhere.
How is a Nano ID different from a UUID?
A UUID is 36 characters in a fixed format. A Nano ID is shorter and flexible, often 21 characters. The default 64-character alphabet packs more into each character, so it stays compact and URL-safe.
What size should I choose?
The default 21 suits most database keys and links. Use a larger size for very high record counts. Short ids of 8 to 10 can work for low-volume, non-critical labels where repeats are acceptable.
What does the collision estimate mean?
It estimates how long until a 1% chance that two ids match, assuming 1000 new ids each second. Longer ids and bigger alphabets push that time far higher. The default setting is already safe for most needs.
Can I use my own characters?
Yes. Pick the Custom preset and type an alphabet. The tool removes duplicate characters before building ids. If you enter fewer than two unique characters, it shows a message and makes no ids.
Can I make a large batch at once?
Yes, up to 1000 ids in one run. Set the quantity and generate. You can then copy the full list or download it as a plain text file for import elsewhere.
This calculator gives general estimates only and is not professional advice. Reviewed for general accuracy by Prof. Dr. Khalil Mudassar, PhD.