Zero Signup ToolsFree browser tools

Generator Tools

NanoID Generator

Generate URL-safe NanoID identifiers in your browser using crypto.getRandomValues. Unbiased rejection sampling, custom alphabets, sizes, and batches.

NanoID generator

Alphabet preset

Pick a built-in alphabet or type your own below. The default 64-character URL-safe alphabet matches the official nanoid library.

Generated IDs (0)

Click Generate IDs to produce a fresh batch. Each ID is picked independently with unbiased rejection sampling, so the distribution is uniform across the alphabet.

Collision probability

Calculated from the birthday-paradox approximation for an alphabet of 64 characters at length 21. Useful for sizing IDs before they go to production.

Total ID space

8.51 x 10^37

64^21 possible values

Entropy per ID

126.00 bits

6.00 bits per character

Safe at 1% collision

~1.31 x 10^18

IDs before P(collision) reaches 1%

Safe at 50% collision

~1.09 x 10^19

IDs before P(collision) reaches 50%

How NanoID differs from UUID

  • A default NanoID is 21 characters of URL-safe text (about 126 bits of entropy); a hyphenated UUID v4 is 36 characters but only 122 bits, because version and variant nibbles are fixed.
  • NanoIDs use a configurable alphabet, which means you can shorten them, drop look-alike characters, or fit them inside an existing column type without changing the security properties.
  • Both rely on crypto.getRandomValues, so the random source is the same; only the encoding and length differ.
  • NanoIDs are not time-sortable. Reach for ULID or UUID v7 when you want your primary keys to sort by creation time.

Picking a size for your use case

  • Short slugs and codes: size 8 to 12 with the default alphabet is enough for thousands to hundreds of thousands of values without practical collision risk.
  • App primary keys: the default size 21 with the URL-safe alphabet handles billions of records before collisions become statistically interesting.
  • Public tokens or share links: raise size to 24 to 32 if the URL has to resist brute-force guessing or you cannot rate-limit requests.
  • Numbers-only IDs: expect about 3.3 bits per character. Use a noticeably larger size than you would with the default alphabet to keep the same security.

How to use

  1. Pick an alphabet preset (URL-safe is the default) or click Custom alphabet and type your own characters. Duplicates trigger a Remove duplicates shortcut.
  2. Set the ID size from 2 to 256 characters using the slider or the number input. The nanoid default is 21.
  3. Set how many IDs you want, from 1 up to 1000.
  4. Click Generate IDs. Each ID appears in the right panel with its own Copy button. Use Copy all for the full batch.
  5. Read the collision-probability panel underneath to confirm the chosen alphabet and size give you the safety margin your use case needs.

About this tool

NanoID Generator creates compact, URL-safe unique identifiers in your browser using the canonical NanoID algorithm. Every byte comes from crypto.getRandomValues, the same cryptographic source that backs crypto.randomUUID, and each character is picked with rejection sampling so the distribution is perfectly uniform across whichever alphabet you choose. The default produces 21-character IDs over a 64-character URL-safe alphabet (A-Z, a-z, 0-9, underscore, hyphen), which matches the nanoid 5.x library and packs roughly 126 bits of entropy into a string a third shorter than a hyphenated UUID. Built-in presets cover the production choices people reach for most: URL-safe for the default behavior, No look-alikes that drops 0, O, I, l, and 1 so a printed code never gets misread, Lowercase and Uppercase for slug-friendly output, Numbers only for short verification codes, Base58 (the Bitcoin alphabet without 0, O, I, l), Base62 for letter-and-digit-only IDs, Hex lowercase for 4-bit-per-character IDs, and Crockford Base32 for the ULID-style symbol set. Custom alphabet mode lets you type any sequence of characters (up to 256), warns on duplicates so the distribution stays uniform, and includes a one-click deduplicator. Size is configurable from 2 to 256 characters via slider or numeric input, and you can generate a batch of 1 to 1000 IDs at once with per-row Copy buttons and a Copy all action. A live collision-probability panel reports the total ID space, entropy per ID, and the number of IDs you can safely draw before the chance of a duplicate reaches 1% or 50% (computed from the standard birthday-paradox approximation), so you can size IDs deliberately for slugs, app primary keys, share tokens, idempotency keys, or short verification codes. NanoIDs are not time-sortable; reach for ULID or UUID v7 when you need lexicographic sort by creation time. Generation runs entirely in your browser; the IDs and any custom alphabet you type never leave your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsGenerator Tools