Nanoid Generator

Generate compact, URL-safe unique IDs


1. What is Nanoid?

Nanoid is a tiny, secure, URL-friendly unique string ID generator. It's smaller and faster than UUID, and uses a larger alphabet than UUID (A-Za-z0-9_-), making it more compact.

2. How does it work?

Why use Nanoid?

  • Small: Only 21 characters by default (vs 36 for UUID)
  • Fast: 2x faster than UUID
  • Safe: Uses cryptographically strong random API
  • Compact: Uses larger alphabet (64 symbols vs 16 for UUID)
  • URL-safe: Can be used in URLs without encoding

Collision Probability

With the default 21 character length, you would need to generate 1 million IDs per second for approximately 4 million years to have a 1% probability of a collision.

3. Examples

Default length (21)

V1StGXR8_Z5jdHi6B-myT

Shorter (10)

IRFa-VaY2b

Custom length (32)

ppBqWA9-TdOtWAFIj1nQH_FI5bw5xM9G

References