Nano ID Generator
Generate Nano IDs — tiny, secure, URL-friendly unique string IDs. Pick a length, count, and alphabet (URL-safe, alphanumeric, numeric, hex, no-look-alikes, or a custom set), and export as plain text, a JSON array, or CSV. IDs are built from a cryptographically-secure random source, entirely in your browser.
Input
Characters per ID. 21 (the default) matches UUID v4's collision resistance — about 149 billion years to a 1% collision at 1000 IDs/hour.
Number of IDs to generate at once.
The character set IDs are drawn from. Smaller alphabets need a longer length for the same entropy.
Output
Guides
Generate Nano IDs — tiny, secure, URL-friendly unique string identifiers — right in your browser. Choose the length, how many to create, and which alphabet to draw from, then copy the result or export it as plain text, a JSON array, or CSV.
What is Nano ID?
Nano ID is a compact unique-ID generator created by Andrey Sitnik. A default Nano ID is 21 characters long and drawn from a URL-safe alphabet: A–Z, a–z, 0–9, plus _ and -. That 21-character default carries about 126 bits of entropy, giving it the same practical collision resistance as a UUID v4 while being 41% shorter and safe to drop straight into a URL, filename, or DOM id without escaping.
Every character comes from a cryptographically secure random source (crypto.getRandomValues), not Math.random(). Nano ID masks each random byte down to the smallest power of two that covers the alphabet and discards any value that falls outside it. That rejection-sampling step is what keeps the output perfectly uniform for any alphabet size — including ones that aren't a power of two — so no character is ever more likely than another.
Nano ID vs UUID
Both give you collision-resistant unique IDs, but they make different trade-offs:
- Shorter: 21 characters versus 36 for a UUID v4 — noticeably smaller in URLs, logs, and databases.
- URL-safe by default: no hyphenated grouping to worry about; the ID drops straight into a path or query string.
- Customizable alphabet: restrict IDs to digits, hex, human-friendly characters, or any set you like — UUIDs are fixed-format.
- Comparable security: the default 21-char ID (~126 bits) is on par with UUID v4 (~122 bits).
Unlike UUID v1/v7, Nano IDs are not time-sortable. If you need lexicographically sortable identifiers, reach for a KSUID or ULID instead.
Choosing a length and alphabet
- 21 (default): the right choice for most applications — public IDs, record keys, tokens.
- 10–14: compact share codes, internal references, or moderate-volume URLs.
- 6–8: coupon codes or one-time links — pair with rate limiting, since the ID space is small.
- 32+: maximum collision resistance for very high-volume systems.
The built-in no look-alikes alphabet skips characters people confuse when typing (0/O, 1/I/l), which is ideal for codes read aloud or entered by hand. Hex alphabets produce IDs that resemble hashes. Remember that a smaller alphabet shrinks the ID space, so increase the length to keep the same entropy.
Are these IDs unique?
Nano IDs are statistically unique, not guaranteed unique — collisions are astronomically unlikely at the default length but never mathematically impossible. For a unique database column, keep a uniqueness constraint as a backstop.
Is anything sent to a server?
No. Every ID is generated locally in your browser from your device's secure random source. Nothing is transmitted or stored.
Use it from code
From 3 credits per callREST API
curl -X POST https://api.iotools.cloud/v1/tool/nanoid-generator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"length": "21",
"count": "10",
"alphabetType": "urlsafe",
"customAlphabet": "",
"outputFormat": "text"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `nanoid-generator` tool (Nano ID Generator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.