DevsToolkit

NanoID Generator

Identifiers

Generate compact, URL-safe NanoIDs with a configurable alphabet and length — a smaller, faster alternative to UUID

All processing happens locally in your browser — your data never leaves your machine.
Loading tool...

Examples

Default NanoID

Input
size = 21, alphabet = URL-safe (A-Za-z0-9_-)
Output
V1StGXR8_Z5jdHi6B-myT

Short Numeric Code

Input
size = 8, alphabet = digits only (0-9)
Output
48273619
07394821
50183267

No-Look-Alikes for Print

Input
size = 10, alphabet = no look-alikes (excludes 1/I/l/0/O)
Output
T3w8mqkxYJ
n4Wj7chgQk
fG6yzVERHm

Hex Token

Input
size = 32, alphabet = hex (0-9a-f)
Output
a3f1c7b2e9d04658f12c3b9e7a5d8b40

Frequently Asked Questions

What is NanoID?
NanoID is a small, secure, URL-friendly unique string ID generator. The default version produces 21-character IDs using a 64-character URL-safe alphabet (A–Z, a–z, 0–9, _, -), giving roughly the same collision resistance as a UUID v4 in fewer bytes. It is widely used for database keys, file names, and short shareable URLs.
NanoID vs UUID — which should I use?
Use NanoID when you want shorter, URL-safe identifiers (21 vs 36 characters) and the ability to customize the alphabet. Use UUID v4 when you need to interoperate with systems that expect the canonical 36-character hyphenated format (e.g., Postgres uuid columns, third-party APIs). Both rely on cryptographically secure randomness from the Web Crypto API.
Can I customize the alphabet?
Yes. You can use only numbers, only lowercase letters, hex, or a 'no-look-alikes' alphabet that excludes visually similar characters (1/I/l, 0/O/o). Custom alphabets are useful when IDs need to be typed by hand, displayed on paper, or kept case-insensitive.
How likely is a collision?
With the default 21-character URL-safe alphabet, you would need to generate about 149 billion IDs per second for 1,000 years to reach a 1% probability of a single collision. Smaller sizes or smaller alphabets reduce this, so always pick a size appropriate for your generation rate.
Is generation private?
Yes. NanoIDs are generated locally using crypto.getRandomValues. No identifiers are sent to any server, stored, or logged.

Related Tools