Nanoid Generator

Generation Options
Generated Nanoids
Nanoid Analyser
About Nanoid

Nanoid is a tiny, secure, URL-friendly unique string ID generator. Default IDs are 21 characters using 64 URL-safe symbols, providing ~126 bits of entropy.

Structure
  • Alphabet: A-Za-z0-9_-
  • Size: 21 characters
  • Entropy: ~126 bits of entropy
Advantages
  • Compact - shorter than UUID
  • URL-safe by default
  • Cryptographically secure
  • Customisable alphabet and size
Use Cases
  • Database Keys - compact primary keys
  • Short URLs - URL-friendly by default
  • API Tokens - secure random strings
  • File Names - safe characters only
Quick Actions

Nanoid Generator - Compact, URL-Safe Unique Identifiers

Generate Nanoid strings for your applications. Nanoid is a modern alternative to UUID that produces shorter, URL-friendly identifiers with comparable collision resistance. Perfect for database keys, short URLs, and API tokens.

What is Nanoid?

Nanoid is a tiny (130 bytes minified), secure, URL-friendly unique string ID generator. It uses a 64-character URL-safe alphabet by default, producing 21-character IDs with approximately 126 bits of entropy - comparable to UUID v4's 122 bits but in a much more compact format.

Nanoid vs UUID

  • Size: Nanoid is 21 characters vs UUID's 36 characters (42% shorter)
  • URL safety: Nanoid uses only URL-safe characters by default, no encoding needed
  • Customisable: Nanoid supports custom alphabets and sizes, UUID has a fixed format
  • Entropy: ~126 bits (Nanoid default) vs 122 bits (UUID v4) - both excellent
  • Standardisation: UUID is an RFC standard with wider tooling support

When to Use Nanoid

  • Short, clean URLs and slugs
  • Client-facing identifiers where compactness matters
  • Database primary keys with minimal storage overhead
  • API tokens and session identifiers
  • File names and asset identifiers
  • Any context where URL-safe characters are required

Nanoid Questions

Nanoid is a tiny, secure, URL-friendly unique string ID generator. It produces 21-character IDs by default using a 64-character alphabet (A-Za-z0-9_-). Smaller and faster than UUID, with comparable collision resistance.

Nanoid is shorter (21 chars vs 36), URL-safe by default, and uses a larger alphabet so it packs more entropy per character. UUID is more widely supported and standardised. Use Nanoid when size matters - short URLs, client-facing IDs, compact storage. Use UUID when interoperability is the priority.

Yes. Nanoid uses crypto.getRandomValues() in browsers and crypto.randomBytes() in Node.js - the same CSPRNGs used for TLS. The default 21-character ID has ~126 bits of entropy, comparable to UUID v4's 122 bits.

Absolutely. You can use any set of characters - numbers only, hex, lowercase alphanumeric, or your own custom set. Just note that smaller alphabets need longer IDs to maintain the same collision resistance. The tool calculates entropy automatically.