NanoID Generator

Generate short, URL-safe, random NanoIDs with any alphabet.

Your input

characters
 
0 lines · 0 bytes

What is a NanoID?

A NanoID is a short, random identifier. By default it has 21 characters from a 64-character URL-safe alphabet (A-Z, a-z, 0-9, underscore and hyphen). That gives about 126 bits of randomness, comparable to a standard random UUID, in a shorter string.

You choose the length and the alphabet. A smaller alphabet or shorter ID means fewer bits and a higher chance of two matching. The tool shows the number of bits so you can judge this. Every character is chosen by unbiased sampling from your browser's secure random generator, so some characters are not favored over others.

How to use the NanoID Generator

  1. Set the length.
  2. Choose how many IDs you need and the alphabet.
  3. Press the button to generate.
  4. Copy or download the list.

Real situations

When people use the NanoID Generator

  • 1

    Short links and public IDs

    Create compact IDs for share links, invite codes or records that appear in URLs.

  • 2

    Replace UUIDs with shorter strings

    Get the same level of randomness in 21 characters instead of 36.

  • 3

    Custom alphabets for readable codes

    Remove look-alike letters, or use digits only or lowercase only for codes people have to type.

  • 4

    Test data and tokens for staging

    Generate batches of up to 1,000 IDs at a time for fixtures, mock data and development databases.

FAQ

NanoID Generator: questions answered

How long should a NanoID be?

The default of 21 characters gives about 126 bits, which is plenty for almost any use. For short public IDs, 10 to 12 characters of the default alphabet give 60 to 72 bits, fine at moderate scale. The tool shows the bits for your settings.

How likely is a clash?

It depends on bits and how many IDs you make. A 10-digit ID has only 10 billion possible values, so duplicates become likely at around the square root of that, about 100,000 IDs. The default 21-character ID makes clashes negligible in practice.

How many bits does my choice give?

Length times the base-2 logarithm of the alphabet size. For example, 10 digits is 33.2 bits, and the default 21 characters from 64 symbols is 126 bits. The tool shows this under the results.

Can I use my own alphabet?

Yes. Choose Custom and type the characters. You need at least two different ones. Removing similar-looking characters such as 0, O, 1 and l makes codes easier to read aloud.

Are NanoIDs suitable as secret tokens?

They are random enough, given a long length, but a password-reset token should be long and come from a proven secure source. Use at least 21 characters of the default alphabet and follow your security rules.

Do NanoIDs sort by time?

No. They are purely random, unlike ULIDs and KSUIDs. If you want sortable IDs, choose one of those instead.

Is this NanoID Generator free and private?

Yes. It is free with no sign-in, and every calculation runs inside your browser. Nothing you type is sent to a server or stored, and the page keeps working offline once it has loaded.

Private by design. No accounts, no cookies, no tracking. Everything you type stays on your device.

How we keep it that way