NanoID generator
NanoID generator, random IDs from crypto.getRandomValues, nothing is uploaded.
Runs on your device. The file is never uploaded.
NanoID generator prints 21 characters pulled from a 64-symbol alphabet of letters, digits, underscore and hyphen, one byte of crypto.getRandomValues per character. Because 256 divides evenly by 64, every symbol is equally likely. Neither the length nor the alphabet can be changed on this page; count, how many to print, is the only option.
Questions
How long is the ID and what is in it?
21 characters drawn from a 64-character alphabet: A to Z, a to z, 0 to 9, plus underscore and hyphen. The length is fixed at 21, the NanoID default, and there is no size option on the page. The bytes come from crypto.getRandomValues, the browser cryptographic random source.
Is it safe to put in a URL?
Yes. Every character in the alphabet is URL-safe and needs no percent encoding, which is the reason for underscore and hyphen rather than the plus and slash of base64. It is safe in a filename on any common filesystem too, though a leading hyphen can confuse command line tools that read it as a flag.
Is there modulo bias in the character choice?
No. Each character comes from one random byte reduced modulo 64, and 256 divides exactly by 64, so all 64 characters are equally likely. That gives 6 bits per character and 126 bits across the 21 characters, slightly more than the 122 random bits in a UUID v4.
Can I change the length or the alphabet?
Not here. The only option is count, how many to generate. The alphabet and the length of 21 are fixed in this tool. If you need a different size, use the NanoID library in your own code; if you need a longer ID from this site, the UUID and ULID tools are the alternatives.
Why is NanoID shorter than a UUID?
Because it packs more into each character. A UUID writes 122 random bits as 32 hex digits and four hyphens, using only 16 symbols per position. NanoID uses 64 symbols, so 21 characters carry a comparable amount of randomness in about half the space, with no hyphens to strip out later.
Where are they generated?
In your browser, inside a Web Worker, from the browser cryptographic random source. Nothing is requested from a server and nothing is stored, so an ID you intend to use as an unguessable token has never existed anywhere else. You can generate between 1 and 1000 per run.