NanoID Generator
Free NanoID generator: create compact, URL-safe random IDs of 5 to 128 characters with preset or custom alphabets, and estimate how long until a 1% collision.
How to use NanoID Generator
- 1Set the ID length and choose an alphabet, or enter a custom one.
- 2Choose how many IDs you want, up to 1,000, and press Regenerate for a new batch.
- 3Enter how many IDs you create per hour to see the collision estimate, then copy or download the list.
What makes it better
- Length from 5 to 128 characters, up to 1,000 IDs per batch
- URL-safe, alphanumeric, lowercase, numbers, hex and no look-alike alphabets
- Custom alphabet of up to 256 characters
- Selection without modulo bias, using masking and rejection like NanoID
- Live entropy and collision-time estimate
About NanoID Generator
NanoID Generator creates short random identifiers in the style of the NanoID library. Pick a length from 5 to 128, a ready-made alphabet such as URL-safe, lowercase and digits, or no look-alikes, or type your own, and make up to 1,000 at once. A collision calculator shows the entropy and an estimate of how many years it would take to reach a 1% chance of a duplicate at your pace.
Common uses
- Create short public IDs for links, invites or database rows that are shorter than a UUID.
- Generate human-friendly codes using an alphabet without look-alike characters.
- Work out how long an ID must be to stay collision-free at your expected volume.
- Fill test data with realistic random identifiers of a fixed length.
Example
Input
Size 21, URL-safe alphabet (sample only: every ID you generate is new)
Result
V1StGXR8_Z5jdHi6B-myT
Good to know
- The collision figure is an estimate from the birthday bound, assuming perfectly random IDs. It is not a guarantee, and a database unique constraint is still the right safety net.
- A random ID is not a secret. For access tokens or API keys use the Secret Key Generator, which is designed for that purpose and shows its strength.
- Shortening the ID or the alphabet cuts the entropy fast. Numbers only at length 8, for example, give about 26.6 bits and will collide in realistic use.
NanoID Generator FAQ
How is a NanoID different from a UUID?
A UUID is a fixed 36-character format with 122 random bits. A NanoID uses a configurable alphabet and length, and the default 21 URL-safe characters hold about 126 bits in a shorter string.
How is the collision time calculated?
With the birthday bound: the chance of a duplicate after k IDs is about 1 - e^(-k²/2N), where N is the alphabet size raised to the length. The tool solves for 1% and divides by your IDs per hour.
Why does the generator not just use a remainder to pick characters?
A remainder favours the first characters whenever 256 is not a multiple of the alphabet size. This tool masks each random byte to the nearest power of two and discards values outside the alphabet, so every character is equally likely.
What is the no look-alikes alphabet?
It is the NanoID collection nolookalikes-safe, 49 characters that drop symbols easily confused with each other, such as 0, O, 1, l and I. Use it for codes that people read or type by hand.
How long should my IDs be?
Use the calculator: enter your length, alphabet and the number of IDs per hour, and aim for a collision time far longer than your system will live. Add more characters until the estimate is comfortably huge.