Generator Tools
Nano ID Generator
Generate Nano IDs in your browser with a custom alphabet and length. URL-safe by default, bulk output, entropy, and a collision-chance estimate.
Nano ID generator
Generated IDs (0)
Pick an alphabet and size, then click Generate Nano IDs to create a fresh batch.
Collision estimate
At the chosen alphabet and size, this is how long you can keep generating IDs before there is roughly a 1% chance of a single collision.
Time to ~1% collision chance
about 149.2 billion years
IDs needed for that chance
1.31 x 10^18
Estimated with the birthday approximation n is approximately sqrt(2 x N x ln(1 / (1 - p))) over the ID space N = alphabet size raised to the ID length, with p set to 1%. It is a guide, not a guarantee.
Active alphabet
64 characters, 6.00 bits each
useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict
Total randomness per ID = ID length x bits per character. The default Nano ID (size 21, 64 characters) carries about 126 bits, matching a random UUID in fewer characters.
How Nano ID generation works
- A bitmask is built as (2 << (31 - Math.clz32((len - 1) | 1))) - 1, the smallest power-of-two-minus-one that can index the alphabet.
- Each random byte from crypto.getRandomValues is reduced with byte & mask. Values that land outside the alphabet are discarded, so every character stays equally likely (no modulo bias).
- Random bytes are drawn in batches sized by ceil(1.6 x mask x size / len), which over-allocates slightly so one batch usually fills the ID even after rejections.
- Unlike a UUID, a Nano ID has no version bits or fixed layout: its strength comes entirely from the alphabet size and the ID length you choose.
How to use
- Pick an alphabet: keep the Nano ID default (64 URL-safe characters), choose a preset such as lowercase plus numbers, no look-alikes, or hex, or select Custom alphabet to type your own.
- Set the ID length (size). The Nano ID default is 21; the entropy readout shows the bits per ID so you can tell when an ID is strong enough or too short.
- Set how many IDs to create, then click Generate Nano IDs to produce a fresh batch.
- Copy a single ID with its Copy button, or use Copy all to grab the whole batch as one list.
- Enter your expected generation rate and unit to see how long you can run before a roughly one percent collision chance, and shorten or lengthen the size accordingly.
About this tool
Nano ID Generator creates Nano IDs in your browser using the exact algorithm from the reference library (ai/nanoid), so the output is distributed the same way the real package distributes it. A Nano ID is a compact, URL-safe, collision-resistant string ID, and it has become a popular alternative to UUID for database keys, public record identifiers, short links, file names, and React keys. The key difference from a UUID is that a Nano ID has no fixed length and no version or layout bits: you choose the alphabet and the size, and its strength comes entirely from those two numbers. The default Nano ID is 21 characters drawn from a 64 character URL-safe alphabet (A to Z, a to z, 0 to 9, plus underscore and dash), which carries about 126 bits of randomness, essentially the same as a random UUID, in fewer characters and with nothing that needs escaping in a URL. This tool generates one ID or a batch at once, and lets you switch the alphabet between the Nano ID default, lowercase plus numbers, alphanumeric, hexadecimal, digits only, a no-look-alikes set that drops easily confused characters like 0, O, 1, and I, or a fully custom alphabet of your own. Under the hood it reproduces the library's two defining formulas: the bitmask is built as (2 left-shift (31 minus Math.clz32 of ((length minus 1) bitwise-or 1))) minus 1, the smallest power-of-two-minus-one that can index your alphabet, and each random byte from crypto.getRandomValues is reduced with byte bitwise-and mask. Bytes whose masked value falls outside the alphabet are discarded, which is what keeps every character equally likely and avoids the modulo bias you would get from a naive remainder. Random bytes are drawn in batches sized by ceil(1.6 times mask times size divided by length), the same slight over-allocation the library uses so one batch usually fills the ID even after rejections. Beyond generation, the tool answers the question every Nano ID adopter actually asks: is my size big enough, and could I safely make it shorter? It estimates how long you can keep generating IDs at a chosen rate, per second, per hour, or per day, before there is roughly a one percent chance of a single collision, using the birthday approximation n is approximately the square root of (2 times N times the natural log of (1 divided by (1 minus p))), where N is the ID space (alphabet size raised to the ID length) and p is one percent. A live entropy readout shows the bits per character and the total bits per ID, with a rough strength label so you can see at a glance when a short ID is too weak or when a long one is overkill. The collision figure is a planning guide rather than a guarantee, and it assumes a good random source, which the browser crypto API provides. Everything, the alphabet, the options, and every generated ID, is computed locally in your browser and is never uploaded, never logged, and never leaves your device.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
UUID Generator
Generate UUID v4 identifiers in batch.
Open tool
GeneratorULID Generator
Generate sortable ULID identifiers and decode any ULID back into its timestamp.
Open tool
GeneratorUUID v7 Generator
Time-ordered UUID v7 generator and version-aware UUID decoder.
Open tool
GeneratorRandom String Generator
Random strings with hex, base32, base58, base62, base64 URL-safe, or a custom alphabet.
Open tool
GeneratorSlug Generator
Turn titles into clean URL slugs.
Open tool