Skip to content
DeveloperRuns in your browser

NanoID Generator

Create compact, URL-safe unique IDs in the NanoID style, in bulk.

Input
No upload needed — instant
Privacy
Nothing is uploaded
Cost
Free · no sign-up · no watermark

Loading tool…

The tool is loading its code on your device. This happens once and is cached for later visits.

Processed entirely on your device

Everything you type or paste is handled by JavaScript running in this tab. No request is sent, nothing is logged and nothing is stored. Close the page and it is gone.

Overview

About the NanoID Generator

Generate NanoID-style unique IDs free. Pick a length and an alphabet — URL-safe, alphanumeric, lowercase, numeric or hex — and create a batch of compact random identifiers for keys, tokens and slugs in your browser.

Unique identifiers are everywhere in software: database keys, session tokens, file names, URL slugs, order references. A UUID works but is long and punctuated with hyphens. NanoID is the compact alternative — a short, URL-safe random string with enough entropy to treat as unique — and this generator produces them in bulk, in the browser, with no dependency to install.

The idea in one line

An ID is just a sequence of symbols drawn from an alphabet. The more symbols in the alphabet and the longer the ID, the more possible IDs exist, and the less likely any two of them are to collide. The default alphabet is 64 URL-safe characters — the letters, the digits, underscore and hyphen — and the default length is 21, which together give roughly 126 bits of entropy.

Choosing length and alphabet

AlphabetSymbolsTypical use
URL-safe64Links, slugs, public IDs
Alphanumeric62Keys with no punctuation
Lowercase36Case-insensitive stores
Numeric10PINs, codes, references
Hex16Byte-aligned values
Alphabetic52Words-only identifiers

A smaller alphabet needs a longer ID to reach the same entropy: a numeric code has to be much longer than a URL-safe one to be equally collision-resistant. Match the alphabet to where the ID will live, then choose a length that leaves comfortable margin for however many you will ever generate.

Why the randomness matters

Each character is drawn with rejection sampling over your browser's cryptographic random source, not with a modulo of a raw byte. That detail prevents modulo bias: without it, an alphabet whose size does not divide 256 evenly would quietly favour its first few symbols, shrinking the real entropy below the advertised number. With it, every symbol is equally likely and the stated bit-strength is the true bit-strength.

Collisions, honestly

No random scheme guarantees uniqueness, but the numbers are comfortably large. At 126 bits, generating a billion IDs would still leave the probability of any collision vanishingly small — comparable to a UUID. For almost every application you can treat these as unique without a central coordinator checking each one. If you are generating at extreme scale with a short ID or a small alphabet, lengthen the ID: entropy is cheap and collisions are expensive.

Using it

Set a count and a length, pick an alphabet, and press Generate. You get a batch you can copy whole or line by line, straight into seed data, configuration or a migration. Because generation is entirely local, an ID you intend to use as a secret token is never sent anywhere — though for high-value secrets you should still store them hashed and prefer a dedicated, reviewed library over any ad-hoc generator.

Step by step

How to use the NanoID Generator

  1. Set how many IDs you need and how long each one should be.

  2. Choose an alphabet — URL-safe by default, or alphanumeric, lowercase, numeric, hex or alphabetic.

  3. Press Generate; each character is drawn from the cryptographic source with no modulo bias.

  4. Copy the batch into your keys, tokens or seed data, or regenerate for a fresh set.

Why use it

Benefits and common use cases

What this tool is good for, and what it deliberately does not try to do.

Compact yet collision-resistant

A 21-character URL-safe ID carries about 126 bits of entropy, in the same league as a UUID but far shorter and friendlier in a URL, a filename or a database key.

Six alphabets

Match the character set to the job: URL-safe for links, numeric for PIN-style codes, hex for byte-aligned values, lowercase for case-insensitive stores.

Unbiased randomness

Every character uses rejection sampling over crypto.getRandomValues, so alphabets that are not a power of two stay uniform instead of quietly favouring their first symbols.

Bulk, offline, no library

Produce up to 500 IDs at once without installing NanoID or calling a service. Generation is local, so no key or token you create is ever transmitted anywhere.

Questions

Frequently asked questions

Short, honest answers about quality, limits and privacy.

What is NanoID?

NanoID is a small library for generating short, unique, URL-safe random identifiers as an alternative to UUIDs. This tool reproduces the same idea and the same default alphabet in the browser, so you get compatible-looking IDs without adding a dependency to your project.

How long should my ID be?

The 21-character default is a good general choice at roughly 126 bits of entropy. Shorter IDs are fine for low-volume or short-lived uses; longer IDs, or a larger alphabet, reduce collision odds when you expect to generate very many at high speed.

Are these IDs guaranteed unique?

Nothing random is guaranteed unique, but with 126 bits of entropy the odds of a collision are astronomically small — comparable to a UUID. For most applications you can treat them as unique without a central coordinator checking each one.

Why not just use a UUID?

A UUID is 36 characters with hyphens and about 122 bits of entropy. A NanoID is shorter, has no punctuation, is safe in URLs and filenames, and can be tuned by alphabet and length — often a better fit for public identifiers and slugs.

Can I use these as security tokens?

The randomness here is cryptographically strong, so a sufficiently long ID is suitable for tokens, reset keys or session identifiers. For high-value secrets prefer a dedicated, well-reviewed library and store tokens hashed rather than in plaintext.