Nano ID and random string generator
Generate Nano IDs or random strings from any alphabet and length.
Runs in your browser. Your input is not uploaded.
126.0 bits per ID. At IDs per second, it would take about 41,465,643 years to reach a 1% chance of one duplicate.
What it does
Nano ID produces short random IDs from a URL-safe alphabet of 64 characters. The default length of 21 gives about 126 bits, similar to a UUID v4 in fewer characters.
You can change the alphabet and length to make API keys, invite codes or tokens. The collision estimate shows how long it would take to have a 1% chance of a duplicate at a given rate.
How to use it
- Choose an alphabet or type your own.
- Set the length and how many.
- Generate and copy.
Things to watch for
- Removing look-alike characters makes codes easier to read but lowers the bits per character. Increase the length to compensate.
- Tokens used as credentials should be at least 128 bits.
Questions
- Is this the same as the nanoid npm package?
- Same alphabet, default length and method. Both pick characters uniformly from a secure random source.
- How long should an API key be?
- At least 128 bits: 22 characters from a 64-character alphabet, or 32 hex characters.
- Is there modulo bias?
- No. Characters are chosen with rejection sampling, so every character is equally likely with any alphabet size.
- Are the tokens stored?
- No. They exist only in this page.