Nano ID Generator
Short, URL-safe random identifiers — and what the length actually buys. Free, and runs entirely in your browser — nothing you enter is uploaded or stored.
About Nano ID Generator
Nano ID is the one with no structure in it. Twenty-one characters drawn uniformly from a 64-character URL-safe alphabet — no timestamp, no counter, no machine identifier, nothing that can be read back out. That is the whole design: it is shorter than a UUID, it is safe in a URL without escaping, and it tells anybody holding it precisely nothing.
Twenty-one characters of that alphabet is about 126 bits, which is more than a UUID v4's 122. Shortening it is the tempting mistake. Collisions arrive at the square root of the space, so a ten-character identifier is not half as good as a twenty-character one — it is the square root as good, and the count where a collision becomes likely drops from astronomical to reachable.
The alphabet is a real choice too, and a smaller one costs less than people expect. Digits alone give 3.3 bits per character against 6 for the full set, so a 21-character numeric identifier is 70 bits rather than 126 — still large, but no longer in the range where the answer is simply "never".
The draw is masked and re-tried rather than taken modulo the alphabet size. The obvious byte % 62 favours the first few characters, which is invisible in the output and quietly costs entropy — so this does what the reference implementation does.
Where it helps
- Shorter than a UUID and URL-safe without escaping, so it fits in a path or a query string as it is.
- Discloses nothing: no creation time, no ordering, no volume, no machine.
- The length and the alphabet are both yours to choose, and the score prices what each choice costs.
- Drawn without modulo bias, so the entropy is what the arithmetic says it is.
- Runs in this tab; no identifier is sent anywhere.
Limits
- No index locality: every insert lands on a random page, which is what ULID, KSUID and UUID v7 exist to avoid.
- Nothing can be read back out of it — no creation time, which is occasionally the thing you wanted.
- Shortening it is far more expensive than it looks; collisions arrive at the square root of the space.
- It is not a standard with a registry behind it: a parser cannot tell a Nano ID from any other random string.
Frequently asked questions
How long should it be?
Twenty-one is the default because it clears a UUID's randomness at eight fewer characters. Go shorter only where the number of identifiers is genuinely small and you have read the collision figure in the score — and remember that figure counts the total ever issued, not the number alive at once.
Is it safe to use as a URL for something private?
At the default length, guessing one is not feasible. But an unguessable URL is a bearer token: anyone who gets the link has the thing. That is fine for a share link and not fine as the only control on something sensitive.
Why is the default alphabet in that strange order?
Because the reference implementation's is. Any 64 URL-safe characters give an identical distribution; using the same order means an identifier from here is indistinguishable from one the library would have produced.
Related tools
- UUID Generator — UUID v1 to v7 — generate any version, or read what one encodes
- ULID / CUID Generator — Sortable, collision-resistant identifiers — and the timestamp inside one
- TypeID Generator — Type-prefixed identifiers over UUID v7, readable and still a UUID underneath
- Random String — Random identifiers from a chosen alphabet
- KSUID Generator — Sortable 27-character identifiers with a second of time and 128 bits of randomness
- ObjectID Generator — MongoDB's twelve bytes — a timestamp, a process value and a counter
More Generators tools
- UUID Generator — UUID v1 to v7 — generate any version, or read what one encodes
- ULID / CUID Generator — Sortable, collision-resistant identifiers — and the timestamp inside one
- KSUID Generator — Sortable 27-character identifiers with a second of time and 128 bits of randomness
- TypeID Generator — Type-prefixed identifiers over UUID v7, readable and still a UUID underneath
- ObjectID Generator — MongoDB's twelve bytes — a timestamp, a process value and a counter
- Barcode Generator — Draw QR, Data Matrix, Code 128, EAN and more as SVG
- QR Code Generator — Create scannable QR codes as SVG
- UPI QR Code Generator — Make a UPI payment QR code that any UPI app can scan to pay you
- Diagram Studio — Draw architecture, sequence, ER, C4, network and nine other diagrams by dragging shapes and connecting them
- Random String — Random identifiers from a chosen alphabet
- Lorem Ipsum — Placeholder paragraphs, sentences or words
- Fake Data — Synthetic people and companies as JSON, CSV or SQL
- Random Number Generator — Draw uniformly random integers or decimals in a range, with or without repeats