ToolHarbor

NanoID Generator

Generate cryptographically secure NanoID-style random IDs with customizable length and alphabet.

1128
21
Alphabet:
DBJOdUq5KJE2vvZmC8B_Y

Features

  • Generate cryptographically secure random IDs
  • Customizable length (1–128 characters)
  • Choose from lowercase, uppercase, numbers, and symbols
  • Bulk generate up to 100 IDs at once
  • Uses Web Crypto API (crypto.getRandomValues)
  • Works entirely offline — no data leaves your browser

How to Use

  1. 1Set the desired ID length (default: 21)
  2. 2Select which character sets to include in the alphabet
  3. 3Choose how many IDs to generate
  4. 4Click "Generate" to create the IDs
  5. 5Copy individual IDs or all at once

Examples

Default NanoID (21 chars)

Input

Length: 21, Alphabet: a-z A-Z 0-9 -_

Output

V1StGXR8_Z5jdHi6B-myT
Short numeric ID (8 chars)

Input

Length: 8, Alphabet: 0-9

Output

48271653
URL-safe slug (12 chars)

Input

Length: 12, Alphabet: a-z 0-9

Output

k7f9x2m4a8n3

What Is NanoID?

NanoID is a tiny, secure, URL-friendly unique string ID generator. Originally created as a JavaScript library by Andrey Sitnik, it has become a popular alternative to UUID for generating random identifiers. The default NanoID is 21 characters long and uses an alphabet of 64 URL-safe characters (A-Z, a-z, 0-9, - and _), providing 126 bits of entropy — comparable to UUID v4.

The key advantage of NanoID over UUID is size. A UUID v4 is 36 characters long (including dashes) and uses only hexadecimal characters. A NanoID achieves similar collision resistance in just 21 characters by using a larger alphabet. This makes NanoIDs more compact in URLs, database columns, log files, and anywhere string length matters.

This tool uses the Web Crypto API (crypto.getRandomValues) for cryptographically secure random number generation. This is the same entropy source used by NanoID in production — not Math.random(), which is predictable and unsuitable for security-sensitive identifiers. Every ID generated by this tool is as random as one generated by the official NanoID library.

The customizable alphabet feature lets you tailor the output to your needs. Need numeric-only IDs for order numbers? Use digits only. Want lowercase slugs? Use lowercase letters. Need maximum entropy per character? Use the full default alphabet. The collision probability depends on both the length and the alphabet size — the tool gives you full control over this trade-off.

All ID generation happens in your browser using the Web Crypto API. No server requests, no logging, no data collection. Generate production-ready IDs with confidence that the entropy source is secure and the output never leaves your device.

Frequently Asked Questions

Related Tools