UUID generator · formatNanoID — a short identifier

NanoID is 21 characters from a 64-character alphabet of A–Z, a–z, 0–9, “_” and “-”: 126 random bits — slightly more than UUID v4's 122 — yet 15 characters shorter and needing no URL encoding. Length and alphabet are adjustable, and they decide how many values you can issue before collisions become a risk.

01Generator02Anatomy03Comparison04Questions05Related
01

Generator NanoID

the format is set — all settings and the checker are in the full generator
Length
21~126 bits
Alphabet
Count
Press Generate — identifiers will appear here.
All formats, plus checking and decoding a UUID, are in the full generator →
02

How it is built: NanoID

SampleV1StGXR8_Z5jdHi6B-myT
V1StGXR8_Z5jdHi6B-myT
21 characters — 6 random bits each
A–Z a–z 0–9 _ -
a 64-character, URL-safe alphabet
21 × 6
= 126 bits, four more than UUID v4

When to use it

  • An ID in a page address: short links, document IDs, invites.
  • Codes people read — with the alphabet that drops look-alike characters.
  • Not for a database sorted by time: there is no time inside and the order is random.

How it differs from its neighbours

Against UUID v4: as much randomness or more in 21 characters instead of 36, with no hyphens, but NanoID is a library rather than a standard, and a database uuid column will not accept it. Against ULID: ULID sorts by time, NanoID does not. Shortening NanoID shrinks the margin: 10 characters is 60 bits, and collisions become real at billions of values.

03

Format comparison

FormatLengthRandomnessTime insideSortableStandard
UUID v436122 bitsnonoRFC 9562
UUID v73674 bitsms, 48 bitsyesRFC 9562
UUID v136node and counter100 ns, 60 bitsnoRFC 9562, legacy
Nil UUID36noneno—RFC 9562
NanoID21126 bitsnonoa library, not an RFC
ULID2680 bitsms, 48 bitsyesULID spec, not an RFC
04

Frequently asked questions

In length and status. By default a NanoID is 21 characters without hyphens from a URL-safe alphabet, with 126 random bits; a UUID v4 is 36 characters and 122 bits. But UUID is an RFC standard with a database type and functions in every language, while NanoID is a library. NanoID suits links and screens, UUID suits schemas and protocols.

Updated

«» added to favorites