1. Home
  2. Developer tools
  3. NanoID Generator

NanoID Generator

Choose a length and a set of characters and generate random IDs in bulk. A calculator beside the output shows how many bits the ID has and how soon duplicates become likely at the rate you create them.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use NanoID Generator

  1. Set the length, count and alphabet.
  2. Click Generate and copy the IDs.
  3. Enter your IDs per day to see the collision odds.

Features

  • Alphabet presets plus your own characters
  • Length 1 to 256, up to 1000 IDs
  • Secure random bytes without modulo bias
  • Bits of strength shown
  • Chance of a duplicate over a year
  • IDs needed for a 1% chance

Supported formats

Input

  • Length
  • Alphabet

You get

  • ID list

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the NanoID Generator is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Collision odds are the birthday-problem approximation and assume IDs are truly random and independent.
  • IDs with a small alphabet or length are easy to guess and should not be used as secrets.

Guide

Random IDs with your own alphabet, and how likely a clash is

Short random IDs are a convenient way to name things: a URL slug, a coupon code, a row key, a file name. The design question is always the same: how long must the ID be, and which characters may it use, so that clashes never happen in practice? This page generates IDs in the style of the NanoID library and answers that question with numbers for your own settings.

How an ID is made

You choose a length and an alphabet. For each position, the generator takes a random byte from the browser’s secure random source, keeps only the low bits so the value falls into a power-of-two range that covers the alphabet, and uses it if it points to a real character; otherwise the byte is thrown away and another is drawn. This rejection step is what keeps every character equally likely. A simple remainder operation would favour the first characters whenever the alphabet size does not divide 256.

Alphabets

The default alphabet has 64 characters: the digits, the upper-case and lower-case letters, and the underscore and hyphen, all safe in URLs. The other presets are letters and digits (62 characters), lower-case letters and digits (36), digits only (10), hexadecimal (16) and an alphabet that leaves out 0, O, 1, l and I so that codes read aloud or typed from paper are not misread. Choosing “My own characters” lets you type any set of 2 to 256 different characters, and repeated characters are removed.

Strength and the birthday problem

Each position adds log2(alphabet size) bits. The default 21 characters from 64 give 126 bits. To judge the risk of two IDs being equal you need the birthday approximation: with N possible IDs, the probability of at least one duplicate among n IDs is about n squared divided by 2N, so clashes appear far sooner than the total space suggests. The panel computes this for the number of IDs you create per day over a year, and also the number of IDs after which the chance of a duplicate reaches 1 percent.

Choosing a length

For the default 21-character ID, creating a million a day for a year gives a duplicate chance of about 7.83 × 10⁻²², and you would need roughly 1.31 × 10¹⁸ IDs to reach a 1 percent chance. A short ID tells a different story. Eight characters from the 36-character lower-case alphabet give 41.4 bits, and a million IDs already carry a clash probability of about 16 percent, with a 1 percent chance after only 238,000. Short IDs are fine when the application checks for duplicates and retries, as a database unique constraint allows.

A worked example

With the default settings, pressing Generate produces five 21-character IDs, each made only of A–Z, a–z, 0–9, _ and -. The strength line reads 126.0 bits and the alphabet size 64 characters. Changing the alphabet to digits only and the length to 6 gives a million possible codes, 19.9 bits, and a quick look at the panel shows why such codes need a duplicate check and an expiry.

Limits

The estimate assumes that IDs are random and independent, which the generator ensures, and it ignores any structure of your own system. The tool produces random IDs, not ordered ones, and not IDs that carry meaning. It is a generator for examples, tests and one-off needs; production systems should generate IDs on the server with a vetted library. The page makes no network requests, and generated IDs are not saved.

Checked against the current version of the NanoID Generator on .

Frequently asked questions

Is it safe to use these IDs as passwords or access tokens?

The randomness is cryptographically strong, so a long ID with a large alphabet is hard to guess. Short IDs or small alphabets are not: 8 lower-case letters give only about 37 bits. For secrets, use at least 128 bits and keep them off the page in logs and URLs that others can see.

What is modulo bias and does this generator have it?

Taking a random byte modulo the alphabet size favours some characters when 256 is not a multiple of the size. The generator avoids it by masking the byte to a power of two and discarding values that fall outside the alphabet, so every character is equally likely.

Is a 21-character NanoID as safe as a UUID?

With the default 64-character alphabet it has 126 random bits, close to the 122 of a UUID version 4, so collisions are similarly unlikely.

Why avoid look-alike characters?

If people read or type the IDs, leaving out 0, O, 1, l and I prevents mistakes. It makes the alphabet smaller, so use a few more characters.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.