Sébastien Rigaux

Nano ID: short, secure IDs for JavaScript

View resource

github.com

Nano ID generates compact, URL-friendly random identifiers designed for a collision probability comparable to UUID v4. The repository documents the JavaScript API, its use cases, and security trade-offs; the implementation is listed at 117 bytes minified and Brotli-compressed, with no dependencies.

Its default A-Za-z0-9_- alphabet keeps IDs to 21 characters. The README also explains that shortening an ID increases collision risk and advises against using nanoid() as a React key, which should remain stable across renders.

Illustration of the ai/nanoid GitHub repository, showing its name, a short description of the ID generator, and contribution and popularity statistics.