NanoID Generator
Generate URL-safe NanoIDs.
About this tool
Generate a NanoID: a compact random identifier built from the characters A-Z, a-z, 0-9, underscore and hyphen, so it is safe in URLs and filenames. The web tool starts at 16 characters, and you can change the length.
How to use
How it works
NanoID picks each character at random from a 64-symbol alphabet using the browser's secure random generator. Each character adds 6 bits of randomness, so a 16-character ID has 96 bits, while a 21-character ID (the library default) has 126 bits, similar to a UUID v4.
Worked example
A 16-character ID
- Input
- Length 16
- Output
- lLiIzTbhi8jzJ722
- Walkthrough
- 16 characters at 6 bits each is 96 bits of randomness. Each click returns a new value.
Limitations
- The alphabet cannot be customised here.
- Use 21 characters if you want collision resistance comparable to a UUID.
- Characters such as l, I and 1 can look alike, so the IDs are not ideal for reading aloud.
Questions
What is a NanoID?
How long should a NanoID be?
NanoID or UUID?
Is a NanoID secure enough for a token?
Features
- URL-safe alphabet
- Adjustable length
- Secure random source
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
TypeScript in 100 Seconds
Fireship
Typed JS snippets often get formatted or hashed nearby.
Watch on YouTubeInspect Network Activity - Chrome DevTools 101
Chrome for Developers
Debugging payloads you paste into JSON and JWT tools.
Watch on YouTube
- web.dev
Google
Modern web guidance that pairs with encoding and tooling pages.
- Regular expressions
MDN
JS regex guide aligned with browser-based testers.