Nano ID Generator

Generate compact, URL-safe Nano IDs with custom length and alphabet.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

Nano ID is a tiny, URL-safe unique-ID format used widely as a shorter alternative to UUIDs for database keys, short links, filenames and API tokens. This generator creates Nano IDs entirely in your browser with a length, count and alphabet you control.

How it works

Each character is chosen from your alphabet using rejection sampling, the same unbiased technique as the reference nanoid library. The generator computes the smallest bitmask that covers the alphabet length, then draws cryptographically random bytes from the browser’s Web Crypto source (crypto.getRandomValues). Each byte is masked, and any value that falls outside the alphabet range is discarded and re-drawn. This guarantees no modulo bias — every character is equally likely.

The default alphabet has 64 symbols (A-Z a-z 0-9 _ -), all URL-safe, and the default length is 21 characters, giving collision resistance comparable to a UUID v4.

Example

With the default settings, a generated ID looks like this:

SettingValue
Length21
Alphabet size64
Example outputV1StGXR8_Z5jdHi6B-myT

Shrink the length to 10 and restrict the alphabet to 0123456789abcdef and you get a short hex-style ID such as a3f90c1b7e. Set the count to 100 to mint a whole batch and copy them all at once.

Everything runs entirely in your browser — the random bytes, your custom alphabet and the generated IDs never leave your device.

Ad placeholder (rectangle)