NanoID Generator
Generate short random IDs
Set length, count, and alphabet first to generate NanoIDs; custom alphabets and scenarios are available in Advanced mode.
The full guide also includes pitfalls, worked examples, snippets, FAQs, and related tools for checking results or troubleshooting.
About this tool
Generate short reference IDs using browser cryptographic randomness and rejection sampling. Choose an integer length of 4–64 and a batch of 1–50. Presets use URL-friendly, hexadecimal or lowercase characters; custom alphabets require 2–94 distinct printable ASCII characters without spaces. Custom punctuation may need URL encoding. Collisions remain possible, especially with short IDs. Use these as identifiers rather than authentication secrets. Only settings are saved locally; generated IDs are not saved by this tool.
Production Snippets
Example
text
Length: 21
Count: 5
Alphabet: URL Safe
Purpose: fixture reference IDsScenario Recipes
Create URL-friendly fixture IDs
Goal: Produce a small set of API references.
- Select the URL Safe alphabet, length 21 and count 5.
- Generate and copy the five lines into a test fixture.
- Change length to 4.5 and generate again to see an integer validation error.
Result: Choose an appropriate length and check collisions where your application requires it.
Suggested Workflow
Failure Clinic (Common Pitfalls)
Short and custom IDs have tradeoffs
Cause: A four-character ID has a small search space; custom punctuation can require encoding in URLs.
Fix: Use a longer supported length and choose the URL preset for URL references.
Frequently Asked Questions
What lengths and counts are supported?
Length must be an integer from 4 to 64, and count an integer from 1 to 50. Fractions and out-of-range values are rejected instead of silently rounded.
What can a custom alphabet contain?
Use 2–94 different printable ASCII characters, with no whitespace or duplicate characters. Emoji and other non-ASCII characters are not supported.
Is every character equally likely?
The generator uses browser crypto and rejection sampling to avoid modulo bias for supported alphabets. It reports a failure if the random source is unavailable, throws, or repeatedly produces only rejected bytes.
Are all outputs safe to put in URLs?
The URL, hexadecimal and lowercase presets use URL-friendly characters. A custom alphabet may include punctuation that must be URL-encoded.
Are IDs guaranteed unique or suitable as API keys?
No. Collision risk depends on alphabet size, length and volume. Treat these as reference IDs; use the service’s credential-generation workflow for API keys and authentication secrets.
What is saved or uploaded?
Generation runs locally without uploading results. Length, count and alphabet settings are saved in this browser. Generated IDs are not persisted by this tool; Clear removes its settings draft.
Keep browsing