Developer Tools

Nano ID generator.

Generate short, URL-safe, cryptographically random unique IDs — the same unbiased algorithm as the nanoid package. Pick the alphabet and length, then bulk-create up to 100 at a time.

Advertisement

Options

IDs

Pick options, then press Generate.

How it's generated

Each ID is built by pulling random bytes from crypto.getRandomValues and mapping them onto your chosen alphabet with a bit mask sized to that alphabet — the same masking technique the nanoid package uses to avoid modulo bias (where a naive random % alphabet.length would make some characters slightly more likely than others). Any byte that falls outside the mask is simply discarded and re-rolled, so every character in the output is equally likely.

The default 64-character URL-safe alphabet and 21-character length match Nano ID's own default: at that size, generating 1000 IDs per second, it would take about 149 thousand years for a 1% probability of a single collision.

Reference: ai/nanoid on GitHub is the canonical implementation this generator follows.

Frequently asked questions

How is this different from a UUID?

A UUID v4 is a fixed 36-character (with hyphens) string from a fixed format. A Nano ID is shorter by default (21 characters), URL-safe with no hyphens to escape, and lets you choose the alphabet and length — useful for short links, session tokens, or anywhere a compact ID matters.

Is a shorter or custom alphabet less safe?

Collision resistance depends on alphabet_size ^ length, not on using this exact package. A shorter ID or smaller alphabet (e.g. numbers only) has fewer possible combinations, so pick a length long enough for how many IDs you'll ever generate — the info box above shows the tradeoff for the default settings.

Can I use this for security tokens (e.g. password reset links)?

The randomness source (crypto.getRandomValues) is cryptographically secure, so yes, provided the length is long enough (21+ characters from the full 64-character alphabet is standard practice). Don't reduce the alphabet to numbers-only for anything security-sensitive.

Generated entirely in your browser

Every ID is built locally with crypto.getRandomValues. Nothing is sent to any server, and nothing is logged.

Advertisement
Advertisement
Listening…