Nano ID Generator

Generate Nano IDs online. Customizable size (1–128) and alphabet: URL-safe, alphanumeric, hex, numbers-only, or custom. Single or batch up to 100. Runs in your browser, powered by the nanoid library.

  • Runs in your browser
  • Your data never leaves your browser
  • Free · No Sign-Up

Generate Nano IDs to view and copy the list.

Examples, details and FAQ Worked examples, how it compares with other tools, and answers to common questions.

Nano ID vs UUID Comparison

FeatureNano ID (default)UUID v4
Length21 chars36 chars (with dashes)
Randomness~126 bits122 bits
URL-safe✓ Yes✓ Yes (hyphens are unreserved URL characters, RFC 3986 §2.3)
Custom alphabet✓ Yes✗ No
Sortable✗ No✗ No
Timestamp-embedded✗ No✗ No

Alphabet Reference

PresetCharactersSize
URL-safe (default)A-Za-z0-9_-64
AlphanumericA-Za-z0-962
Numbers only0-910
Lowercase hex0-9a-f16

Examples

IDs are random, so your output will differ. These samples were produced by the same Nano ID 3.3.11 build the page loads, with the settings shown:

SettingsSample output
Size 21, URL-safe (default)-62UNnSvQJQszvDIWGrhq
Size 12, Numbers only342497894935
Size 32, Lowercase hexa5d7f99f620647e488eaef20f1515fa9
Size 8, Custom 23456789ABCDEFGHJKLMNPQRSTUVWXYZ8AQXCDET

The last row uses a custom alphabet without 0, O, 1 and I, a common choice for codes that people read aloud or type from paper, such as voucher or invite codes. A URL-safe ID can start with - or _, as the first row does. If the ID becomes a file name or a command-line argument, a leading - can be read as an option, so pick Alphanumeric there.

Choosing the Size

Each character carries log2(alphabet size) bits of randomness. The table shows the bits at the default size of 21 and the size needed to reach the 126 bits of a default Nano ID:

AlphabetBits at size 21Size for ≥ 126 bits
URL-safe (64)126.021
Alphanumeric (62)125.022
Lowercase hex (16)84.032
Numbers only (10)69.838

By the birthday bound, the default ID (21 × log2(64) = 126.0 bits) reaches a 1% chance of any collision after about 1.3 × 1018 IDs (≈ 1.3 × 10^18).

Short IDs collide much sooner: an 8-character code from the 32-symbol alphabet 23456789ABCDEFGHJKLMNPQRSTUVWXYZ above has 8 × log2(32) = 40.0 bits and reaches a 1% chance after about 149,000 codes (≈ 149,000). Check uniqueness in the database for short codes, or use the UUID Generator when IDs need a standard format.

Random bytes come from crypto.getRandomValues(). The presets are generated by the Nano ID 3.3.11 build that this page loads (/vendor/nanoid.min.js). URL-safe keeps the low 6 bits of each byte, which selects one of exactly 64 symbols. Alphanumeric, Numbers only and Lowercase hex mask each byte to the smallest 2k − 1 that covers the alphabet (63 for 62 symbols, 15 for 10 and 16 symbols) and skip values outside the alphabet. Custom alphabets use 32-bit rejection sampling (see Limits). None of these paths uses a plain modulo, so every symbol is equally likely.

Limits

  • Batch count is clamped to 1–100 and size to 1–128. An empty size, or 0, falls back to 21.
  • Duplicate characters in a custom alphabet are removed; fewer than 2 distinct characters shows an error.
  • Custom alphabets are read by code point: 😀😃🐱 is three symbols, and an ID of size 8 has eight of them (16 UTF-16 code units). The library’s own customAlphabet() works per UTF-16 code unit and allows at most 256 symbols, so for custom alphabets the tool draws a 32-bit random value per symbol instead and discards values at or above the largest multiple of the alphabet size, which keeps every symbol equally likely. Combined characters such as flags or skin-tone emoji are two or more code points and become separate symbols.
  • Nano IDs carry no timestamp and do not sort by creation time. For sortable keys, use the ULID Generator.

Related Tools

FAQ

What is a Nano ID?

Nano ID is a small, secure, URL-friendly unique string ID generator. The default output uses 21 characters from the URL-safe alphabet (A-Za-z0-9_-), providing ~126 bits of randomness — comparable to UUID v4. Nano IDs are shorter and contain no timestamp.

How does Nano ID compare to UUID?

UUID v4 is 36 characters (including hyphens). A default Nano ID is 21 characters with equivalent randomness (~126 bits). Nano IDs are URL-safe by default, have no separators, and allow custom alphabets and sizes — making them more flexible for URLs, filenames, and database keys.

What alphabets are available?

URL-safe (default): A-Za-z0-9_- (64 chars). Alphanumeric: A-Za-z0-9 (62 chars). Numbers only: 0-9 (10 chars). Lowercase hex: 0-9a-f (16 chars). Custom: enter any characters; they are read by Unicode code point, duplicates are removed, and at least 2 distinct symbols are required.

How do I choose the right size?

The default size of 21 gives ~126 bits of randomness with the URL-safe alphabet. If you use a smaller alphabet (e.g., hex with 16 chars), you need a larger size to maintain the same collision probability. As a rule of thumb, each additional character adds log2(alphabet_size) bits.

Are the generated IDs sent anywhere or saved?

No. IDs are generated in your browser from the Web Crypto API (crypto.getRandomValues); the IDs and your custom alphabet are not sent to ZeroTool, and the tool keeps neither after you leave the page. Google Analytics on the page records which action was used (generate, copy), without the IDs.