What it does
This tool generates Nano IDs: short, random, URL-safe identifiers that you can use as database keys, file names, short link slugs, invite codes or test data. It follows the same method as the Nano ID library, so the IDs look and behave like those made by nanoid() in your code.
You can change the length, pick one of the built-in alphabets or enter your own, and generate up to 1000 IDs at once. Below the options you see the entropy per ID and roughly how many IDs you can make before the chance of a duplicate reaches 1%.
How to use
- Choose the Length. 21 is the Nano ID default.
- Choose an Alphabet: URL-safe, alphanumeric, lowercase, hexadecimal, numbers, no look-alikes, or a custom set.
- Choose How many IDs you need. They are generated as soon as you change a setting.
- Click Generate for a new batch, then copy or download the list, one ID per line.
Example
The same IDs in JavaScript, using the nanoid package:
import { nanoid, customAlphabet } from 'nanoid'
nanoid() // "V1StGXR8_Z5jdHi6B-myT"
const orderId = customAlphabet('0123456789ABCDEFGHJKLMNPQRSTUVWXYZ', 12)
orderId() // "4KQ7ZB9XH2MD"
Choosing an alphabet
The URL-safe alphabet packs the most randomness into each character and needs no escaping in URLs, file names or JSON. Alphanumeric drops _ and -, which helps when IDs are selected by double-clicking. Hexadecimal and numbers are useful when a system only accepts those characters, but need longer IDs for the same strength. The no look-alikes set removes characters such as 0 and O or 1, l and I, so IDs are easier to read and type by hand.
FAQ
› What is a Nano ID?
Nano ID is a popular format and JavaScript library for random unique IDs. The default ID is 21 characters from a 64-character URL-safe alphabet (A–Z, a–z, 0–9, _ and -), which gives 126 bits of randomness, close to the 122 bits of a UUID v4 in a much shorter string.
› How long should my IDs be?
It depends on how many IDs you will create. The estimate under the options shows roughly how many IDs give a 1% chance of any two being equal. The default 21 characters is safe for practically any system; 10 to 12 characters is often enough for short links or invite codes, combined with a uniqueness check in the database.
› Are the IDs random enough for security?
The characters come from the browser's cryptographic random number generator, and values that do not fit the alphabet are thrown away rather than wrapped, so every character is equally likely. Long IDs are fine as unguessable tokens. Nothing is sent to a server.
› Can I use my own characters?
Yes. Choose Custom and type the alphabet, for example only uppercase letters for codes that are read aloud. It needs 2 to 256 different characters; repeated characters are rejected because they would make some characters more likely than others.