Nano ID Generator
Generate URL-safe random IDs with Web Crypto. Choose length, count and a custom alphabet with unbiased byte sampling.
How to use
The default alphabet contains 64 URL-safe characters and the default length is 21. Each character contributes 6 bits of randomness, for 126 bits per default ID. Results are generated on your device with crypto.getRandomValues.
Custom alphabets may contain 2–256 distinct characters, without spaces or control characters. Rejection sampling discards bytes that would bias a non-power-of-two alphabet. Length is 1–128; count is 1–1,000.
Behavior and limits
Shorter IDs and smaller alphabets increase collision risk. Randomness does not guarantee uniqueness; enforce a unique index in your database. Custom alphabets can include characters that are not URL-safe.
Questions & answers
Are these official library outputs?
This is an independent Web Crypto implementation of random IDs with a Nano ID-compatible default alphabet and length. It does not reproduce a seeded sequence.
Is my input uploaded?
No. Processing runs in your browser. This tool does not send your input to an API or save it in local storage. Text tools accept up to 200,000 characters.
Other Languages
References
How we make sure
We check this tool with the automated test suites linked below. Example checks are shown in their original language.
- Verification method
- Inject fixed bytes to test rejection sampling and check length, alphabet, Unicode and duplicates in 1,000 samples.
- Comparison reference
- Deterministic random-byte fixtures and explicit expected strings.
- Verification scope
- Finite duplicate checks do not prove cryptographic randomness.
Test source and cases (select a file to read it)
-
workbench.test.js
- Nano ID generation uses Web Crypto, validated alphabets and rejection sampling
These checks cover the listed examples and boundaries, not every possible input. Round trips and checks using the same library are not independent verification.