About the Nano ID Generator
Nano ID is a small random ID format: by default 21 characters from the 64 URL-safe symbols A-Za-z0-9_-. Each character carries 6 bits, so a default ID has 126 bits of entropy, slightly more than the 122 random bits of a UUID v4, in 21 characters instead of 36. It contains no timestamp and no structure, which makes it a good fit for public identifiers, short links and tokens that should reveal nothing.
This page uses the reference algorithm. Random bytes come from crypto.getRandomValues; each byte is masked to the smallest power of two that covers the alphabet, and values beyond the last character are discarded and drawn again. A simple byte % length would make the first characters of the alphabet more likely whenever the length is not a power of two; rejection keeps every character equally probable. Presets cover digits, lower or upper case, alphanumeric, hex and an alphabet without look-alike characters; a custom alphabet may hold 2 to 256 unique characters.
Shorter IDs and smaller alphabets are more convenient but collide sooner. The calculator applies the birthday bound: with b bits per ID, about √(2 · 2b · ln(1/0.99)) IDs give a 1% probability of at least one collision. For the default settings that is about 1.3 × 1018 IDs, or roughly 149 billion years at 1,000 IDs per hour. Enter your own rate to see whether a shorter ID is still safe for your volume.
How to use it
- Set the size of the ID and how many to generate.
- Pick an alphabet preset or type your own characters.
- Enter how many IDs you create per hour or per second to see the collision estimate.
- Click Generate, then Copy all or Download.