Nanoid Generator

Generate short, random, URL-safe IDs like Nanoid. Set the length and alphabet, generate up to 1,000 at once, and see exactly how collision-resistant they are — with the code to produce the same IDs in your app.

URL-safe alphabet (64 symbols)

LengthBitsIDs for 1% collision
848≈ 2.4 million
1272≈ 9.7 billion
1696≈ 4 × 10¹³
21126≈ 1.3 × 10¹⁸

When to use it

  1. Create IDs for database rows, files or URLs.
  2. Pick a safe ID length for your scale.
  3. Generate fixtures and test data.
  4. Make short share links.

How to Use

  1. Choose an alphabet and length.
  2. Generate.
  3. Copy the IDs or the code snippet.

Features

  1. Crypto-secure, unbiased
  2. Custom alphabet and length
  3. Entropy and collision estimate
  4. Bulk generation
  5. Code snippet

FAQs

What is Nanoid?

A tiny library for random, URL-friendly unique IDs — a shorter alternative to UUIDs.

Is a 21-character Nanoid as unique as a UUID?

Yes — 126 bits versus UUID v4's 122.

How short can my IDs be?

Check the collision figure: it should be far above the number of IDs you'll ever create.

Are these IDs secure?

They use a cryptographically secure generator with no bias.

Can I use my own alphabet?

Yes, any characters.

Technical Details

IDs are drawn from crypto.getRandomValues with Nanoid's own technique. Each random byte is masked to the smallest power of two that covers the alphabet, and values outside it are discarded, so every character is equally likely with no modulo bias. The default is 21 characters from the 64-symbol URL-safe alphabet (A–Z a–z 0–9 _ -), giving 126 bits of entropy. Presets cover alphanumeric, lowercase-plus-digits and a no-look-alikes set, or you can use any custom alphabet. Entropy is length × log₂(alphabet size). The number of IDs giving a 1% chance of any collision uses the birthday bound √(2·N·ln(1/0.99)), where N = alphabetˡᵉⁿᵍᵗʰ. The matching nanoid or customAlphabet snippet is shown.

Developer Tools

Developer Tools

  • Random String Generator
  • Test IBAN Generator
  • UUID Generator
  • Regex Tester
  • Cron Parser
  • JSON to TypeScript
  • SQL Formatter
  • CSS Formatter