Choose an ID size for your workload
The default 21-character, 64-symbol alphabet has 126 bits of entropy. Shortening the ID or reducing the alphabet increases collision probability for a fixed population.
Use the upstream random generator
This tool uses NanoID with cryptographically secure randomness. Generated IDs remain in this page unless you explicitly copy or download them. The probability shown is an estimate, not a uniqueness check against your database.
Compare two concrete configurations
Set the expected total population to 100000. These estimates come from the same calculation as the tool; they are the probability of at least one collision across that entire population, not the chance for just the next ID.
| Configuration | Symbols | Length | Entropy (bits) | Collision probability |
|---|---|---|---|---|
| Default URL-friendly alphabet | 64 | 21 | 126 | 5.877e-29 |
| Short hexadecimal identifier | 16 | 8 | 32 | 6.878e-1 |
The approximation is p ≈ 1 − exp(−n(n−1)/(2A^L)), with population n, alphabet size A and length L. It assumes independently uniform random draws. A shorter ID can be convenient, but it still needs a database uniqueness constraint if duplicates would break your application.
Random, sortable or deterministic?
Choose UUID v4 for a standard random UUID, KSUID for a timestamp-bearing sortable identifier, or UUID v5 when the same namespace and name must produce the same ID. NanoID does not encode an event time. Do not use generated identifiers as a substitute for an authorization check.
Documentation examples checked: . How these tools are checked.
Frequently asked questions
Does this guarantee every ID is unique?
No. Independently generated random IDs can collide. The estimate uses the birthday approximation for uniformly random IDs across the total population. Choose sufficient entropy and enforce uniqueness where your application needs it.
Which alphabets are supported?
Use 2–94 unique printable ASCII characters without spaces. The default alphabet is URL friendly. Other alphabets may require URL encoding or escaping in your destination.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.