Skip to content

Menu

Nano ID Generator

Generate compact URL-safe unique IDs

Runs entirely in your browserGeneratorsFree, no sign-up
Loading tool

01What is Nano ID Generator?

Sometimes you want an ID that's short, random and safe to drop into a URL. A UUID works, but it's 36 characters with dashes. Nano ID packs similar randomness into 21 characters from a 64-character URL-safe alphabet, and this tool generates them in batches. It follows the same method the nanoid library uses. It fills a byte buffer with crypto.getRandomValues, the browser's cryptographically secure source. Each byte is masked down to the smallest power of two that covers the alphabet. If the masked value is still too big, that byte is thrown away instead of being wrapped with modulo. Modulo would make the first few characters of the alphabet slightly more likely, and rejection avoids that bias. You control three things. Size runs from 1 to 128 characters, with 21 as the default. Count makes up to 50 IDs at once. Alphabet offers URL-safe (64), Hex (16), Alpha (52), Alphanumeric (62), Numbers (10) and Custom. A custom alphabet must have 2 to 256 distinct, single-unit characters. Duplicates, emoji or a one-character string show an error and stop generation. Under the controls you'll see the alphabet size, the ID length and the entropy, worked out as size times log2 of the alphabet size. There's also a collision estimate based on the birthday bound. It tells you how long you could make 1,000 IDs per second before the chance of any repeat reaches about 1%. A worked example helps. With the defaults, 21 URL-safe characters give about 126 bits, and the estimate reads roughly 41 million years at 1,000 IDs a second. Drop to 12 characters and it falls to 112 days. Eight digits from the Numbers alphabet give only 27 bits, and the estimate is 1 second. That last one is a good reminder that short numeric codes collide almost immediately at scale. Keep the limits in mind. The estimate is a rough approximation that assumes perfectly random IDs and a steady rate, so treat it as an order-of-magnitude guide. Nano IDs carry no timestamp, so they don't sort by creation time. Count tops out at 50 per batch. The IDs are made with your browser's own random generator, and Copy All just puts them on your clipboard one per line.

Developers who need short, URL-safe random IDs or codes and want to see the collision risk of their chosen length before shipping it. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Nano ID Generator

  1. Set Size to the ID length you need.
  2. Pick an Alphabet, or choose Custom and type your own characters in Custom Alphabet.
  3. Set Count for how many IDs to make, up to 50.
  4. Click Generate, then Copy All to grab the batch one per line.
  5. Read the entropy and collision lines to check the length is enough.

03Worked examples

Input: Size: 21, Alphabet: URL-safe (64)
Result: RyGWtfYupeetd1L3dX55- Entropy: ~126 bits ~1% collision probability after 41408945 years at 1000 IDs/sec
The ID is random and will differ each run. The entropy and estimate lines are fixed for these settings.
Input: Size: 12, Alphabet: URL-safe (64)
Result: y11nOdRbjzxi Entropy: ~72 bits ~1% collision probability after 112 days at 1000 IDs/sec
Shorter IDs look tidy but the safety margin shrinks fast.
Input: Size: 32, Alphabet: Hex (16)
Result: 42a79e60d5bbd29e34a5c7c12c399b5a Entropy: ~128 bits ~1% collision probability after 82817891 years at 1000 IDs/sec
Input: Size: 8, Alphabet: Numbers (10)
Result: 68948172 Entropy: ~27 bits ~1% collision probability after 1 seconds at 1000 IDs/sec
Eight digits is fine for a one-off PIN, not for unique keys.
Input: Size: 8, Custom Alphabet: ABCDEFGHJKMNPQRSTUVWXYZ23456789
Result: 32WZSBFR Entropy: ~40 bits ~1% collision probability after 131 seconds at 1000 IDs/sec
31 characters with look-alikes removed. Good for codes people type.
Input: Custom Alphabet: aab
Result: Alphabet has duplicate characters, which would bias the IDs.
Generation is blocked until the duplicate is removed.

04Common use cases

  • Creating short share links like /share/V1StGXR8_Z5jdHi6B-myT instead of exposing database row numbers
  • Making invite or coupon codes from a custom alphabet that leaves out 0, O, 1, l and I
  • Generating client-side primary keys for an offline-first app that syncs to Firestore or IndexedDB
  • Producing a batch of fixture IDs for unit tests or seed files
  • Comparing how length and alphabet change collision risk before you settle on an ID format
  • Getting hex IDs of a fixed length to match a column that only accepts 0-9 and a-f

05Tips

  • 21 URL-safe characters give about 126 bits of entropy, a little more than the 122 random bits in a UUID v4.
  • Every halving of the alphabet costs a bit per character, so hex IDs need to be longer than URL-safe ones for the same safety.
  • A 31-character alphabet without look-alikes, such as ABCDEFGHJKMNPQRSTUVWXYZ23456789, still gives about 40 bits at 8 characters. That's fine for short-lived invite codes but not for permanent keys.
  • URL-safe IDs can start with - or _. If a tool treats a leading dash as a command-line flag, pick Alphanumeric instead.
  • Need IDs that sort by time for a database index? Look at ULID or UUID v7. Nano IDs are fully random.

06Related concepts

Nano ID, UUID, entropy, birthday paradox, CSPRNG, rejection sampling.

Frequently Asked Questions

What is Nano ID Generator?

Nano ID Generator is a free, browser-based developer tool on AIDToolStack. Generate compact URL-safe unique IDs It requires no installation or sign-up and works entirely in your browser.

Is Nano ID Generator free to use?

Yes. No sign-up, no fees and no usage cap.

Does Nano ID Generator store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe