Skip to content
1001 Tools
sr
Developer tools

Nano ID Generator

Generate one or many Nano IDs — compact, URL-friendly random identifiers — with the length and alphabet you choose. Nano ID is a popular alternative to UUID: shorter, collision-resistant and safe to drop into URLs. The IDs are produced with your browser’s cryptographic random generator and never leave the page.

Generated IDs

Generated with crypto.getRandomValues in your browser. Nothing is uploaded.

How it works

Each character is picked from the chosen alphabet using crypto.getRandomValues, the browser’s cryptographically secure random source. Rather than take each random byte modulo the alphabet size — which would make some characters slightly more likely — the generator uses rejection sampling (the standard Nano ID algorithm): it masks each byte to the next power of two and discards values that fall outside the alphabet, so every character is equally probable.

The default is 21 characters from a 64-symbol URL-safe alphabet (A–Z, a–z, 0–9, plus _ and -). That gives roughly the same collision resistance as a UUID while being shorter and needing no percent-encoding in URLs. A shorter length or smaller alphabet raises collision odds — worth weighing when you cut it down.

Practical examples

Default 21-character ID

The standard Nano ID, e.g. V1StGXR8_Z5jdHi6B-myT. It’s URL-safe, so you can put it straight into a path or query string without escaping.

Short human-facing code

Need a short share code? Set length to 8 and the numeric or lowercase alphabet for something like 4f9k2p7q. Shorter IDs collide sooner, so use them where the total count stays small.

Seeding a database

Set count to 1000 to generate a block of IDs for test fixtures or a migration, then copy them all at once from the output box.

Frequently asked questions

What is a Nano ID?

A small, secure, URL-friendly unique identifier. It’s the output of the Nano ID library: by default 21 random characters from a 64-symbol alphabet, designed as a shorter, faster alternative to UUIDs while keeping strong uniqueness.

How is Nano ID different from a UUID?

A UUID is a fixed 36-character format with hyphens; a Nano ID is shorter (21 by default), uses a larger URL-safe alphabet, and lets you choose the length and characters. Both are collision-resistant; Nano ID trades the standardised format for compactness and flexibility.

Are these IDs cryptographically secure?

The randomness is — it comes from crypto.getRandomValues, the same CSPRNG used for other security-sensitive values. That means the IDs are unpredictable. They are identifiers, though, not secrets or tokens; don’t use them in place of a signed session token.

How long should my Nano ID be?

The 21-character default is a safe general choice with collision odds comparable to a UUID. You can go shorter for low-volume, user-facing codes, but each character you drop meaningfully raises collision probability — size it to how many IDs you’ll ever generate.

What alphabets can I choose?

URL-safe (the 64-character default), alphanumeric (no _ or -), lowercase + digits, hexadecimal, and digits only. Smaller alphabets read more cleanly but need more length for the same uniqueness.

Will two IDs ever be the same?

It’s extremely unlikely at the default settings but never mathematically impossible. Collision odds depend on the alphabet size, the length and how many you generate. For anything critical, add a unique constraint in your database as a backstop.

Can I generate many at once?

Yes — set the count up to 1000 and each is generated independently. They appear one per line in the output, ready to copy as a block.

Why avoid _ or - in an ID?

They’re URL-safe, but a leading dash can be awkward in shells and command-line flags, and some systems treat _ specially. If that matters, use the alphanumeric alphabet, which omits both.

Are the IDs sent anywhere?

No. Generation happens entirely in your browser; the IDs are never uploaded and analytics only records that the tool was used, not the values.

Related tools