NanoID Generator

Generate cryptographically secure, URL-safe NanoID strings with customizable length and alphabet. Bulk generate up to 100 IDs at once.

  1. Home
  2. Hash & Security
  3. NanoID Generator

What Is NanoID?

NanoID is a compact, URL-safe, cryptographically secure unique identifier generator. Created as a modern alternative to UUID, NanoID uses a larger alphabet (A-Za-z0-9_- by default, 64 characters) instead of hexadecimal, allowing it to achieve the same collision resistance as UUID v4 with significantly shorter strings. A default 21-character NanoID provides about 126 bits of entropy (vs 122 bits for UUID v4), while being 20% shorter.

NanoID is widely used in modern web development for database primary keys, URL shorteners, API keys, session tokens, and distributed system identifiers. It is cryptographically secure (using crypto.getRandomValues in browsers or Node.js), collision-resistant, and supports custom alphabets for different use cases — from pure numeric OTPs to hex color codes. This tool generates NanoIDs entirely in your browser with no server-side processing.

How to Use This NanoID Generator

  1. Set options — Choose the ID length (1-256), count (1-100), and alphabet preset (URL-safe, alphanumeric, hex, lowercase, uppercase, or numbers-only).
  2. Add prefix — Optionally enter a prefix string to prepend to each generated ID (e.g., usr_, tok_, id-).
  3. Click Generate — Press Generate to create NanoIDs using cryptographically secure random values.
  4. Copy results — Click Copy All to copy all generated IDs to your clipboard at once.

Frequently Asked Questions

How does NanoID compare to UUID?

NanoID uses a 64-character alphabet for compact, URL-safe IDs, while UUID v4 uses hexadecimal. A default 21-char NanoID provides 126 bits of entropy, slightly more than UUID v4's 122 bits, while being 20% shorter.

Is NanoID cryptographically secure?

Yes. This tool uses the Web Crypto API (crypto.getRandomValues()) to generate random bytes, the same cryptographically secure RNG used by browsers for encryption.

How many unique IDs can NanoID generate before collisions?

For the default 21-character URL-safe alphabet, there are 64^21 ≈ 8.5 × 10^37 possible IDs. You would need billions of IDs per second for decades to have a statistically significant chance of collision.

What alphabets can I use?

Six presets: URL-safe, alphanumeric, hexadecimal, lowercase, uppercase, and numbers only — each optimized for different use cases.

Is my data sent to a server?

No. All generation is performed entirely in your browser using the Web Crypto API. No data leaves your device.