Nano ID Generator

Create short, random, URL-safe IDs like V1StGXR8_Z5jdHi6B-myT, up to a thousand at a time. Pick the length and the characters (URL-safe, letters and digits, no look-alike characters, digits only or your own set) and add a prefix such as ord_. The page also tells you how many IDs you could create before a duplicate becomes a 1% risk, so you can pick a safe length.

Alphabetuseandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict

21 is the Nano ID default.

Up to 1,000 at once.

Added in front; it does not add randomness.

Used only for the duplicate estimate below.

126 bits of randomness. A 1% chance of any duplicate after about 1.3 quintillion IDs, which at 1,000 an hour takes about 149 billion years.
0 IDs
Same IDs in your code (npm install nanoid)
import { nanoid } from 'nanoid';

const id = nanoid();

Generating runs in your browser. What you type never leaves this device.

Features

  • Cryptographically random, with no bias towards any character

  • Any length from 2 to 256

  • URL-safe, alphanumeric, lowercase, no look-alikes, digits, hex or custom alphabets

  • Optional prefix such as ord_ or usr_

  • Duplicate-risk estimate for your rate of creation

  • Code snippet with the same settings for the nanoid package

Where short IDs fit

Order and invoice references

Short IDs without look-alike characters are easy to read out over a support call.

Public URLs

Share links like /p/V1StGXR8 that do not reveal how many records you have, unlike 1, 2, 3.

Test data and keys

Fill a sheet or seed a database with unique IDs.

Choosing a length

Length and alphabet set the risk

The default, 21 characters from a 64-character alphabet, has 126 bits of randomness, about as much as a UUID v4. Shorter IDs or smaller alphabets collide sooner. The estimate on the page uses the birthday bound to show when a 1% chance of any duplicate is reached.

Nano ID or UUID?

  • Nano ID: shorter, URL-safe, any alphabet. Good for links and references.
  • UUID: a fixed standard format that databases understand. v7 UUIDs also sort by time. See the UUID generator.

Nano ID Generator - FAQ