Skip to main content
1

Nanoid Generator

Generate Nanoid identifiers with a fully customizable alphabet, configurable length, batch mode, and collision probability stats.

import CopyButton from "./_CopyButton.astro"
Send output to:
Advertisement

How to use Nanoid Generator

  1. Customize the alphabet (or keep the default A-Za-z0-9_-).
  2. Set your desired ID length (1-64) and count (1-100).
  3. Click Generate, review the collision stats, and copy your Nanoids.

What is Nanoid Generator?

Nanoid is a tiny, secure, URL-friendly unique string ID generator. Unlike UUID it lets you define your own alphabet and length, producing shorter IDs with the same collision resistance as UUIDs when configured with a large enough alphabet.

This tool runs fully in your browser using crypto.getRandomValues with uniform distribution. You can customize the character set (default includes A-Z, a-z, 0-9, underscore and hyphen), set any length from 1 to 64, generate up to 100 IDs at once, and see the total possible combinations and collision probability for your configuration.

Advertisement

FAQ

What is Nanoid?
Nanoid is a compact, secure, URL-friendly unique string ID generator. It uses crypto.getRandomValues and a custom alphabet, letting you control the character set and ID length for your specific needs.
How does the alphabet affect collision probability?
The total number of possible IDs is alphabet.length ^ length. A larger alphabet or longer length exponentially increases the number of possible combinations, making collisions astronomically unlikely.
Is the distribution truly uniform?
Yes. This implementation uses a rejection sampling algorithm that discards biased bytes, ensuring every character in your alphabet has exactly equal probability of appearing at each position.
Advertisement