Generate Nano IDs with custom alphabet. Part of the DevTools Surf developer suite. Browse more tools in the Generators collection.
Use Cases
Generate short, URL-safe IDs for permalinks, session tokens, or shareable link slugs.
Create unique IDs for client-side objects before they're persisted to a database.
Generate API correlation IDs for distributed tracing with custom length and alphabet.
Produce batch IDs for test data fixtures or database seeding scripts.
Tips
Use the default 21-character length for collision resistance equivalent to UUID v4 — at 1000 IDs/second, collision probability over 4 billion years is ~1%.
Use the URL-safe alphabet (A-Za-z0-9_-) for IDs embedded in URLs or filenames — it avoids characters that require percent-encoding.
Reduce ID length only for low-volume, short-lived contexts — each character you remove roughly halves the ID space.
Fun Facts
Nano ID was created by Andrey Sitnik (also creator of PostCSS and Autoprefixer) in 2017. It reached 1 billion weekly downloads on npm in 2023 — making it one of the most-downloaded packages ever.
The Nano ID alphabet of 64 URL-safe characters was chosen because 64 = 2^6 — each character represents exactly 6 bits of entropy, giving mathematically clean entropy calculations without approximation.
Nano ID is 3x more compact than UUID v4 in URL-safe form: UUID v4 is 36 characters including hyphens; Nano ID's default is 21 characters with the same collision resistance.
FAQ
How does Nano ID compare to UUID?
Nano ID's 21-character default has 126 bits of entropy vs. UUID v4's 122 bits. Nano ID is URL-safe, 41% shorter, and significantly faster to generate than UUID in JavaScript.
Can I use a custom alphabet?
Yes — define any character set. The tool validates that the alphabet doesn't contain duplicate characters and calculates the resulting entropy per character for your custom combination.
Is it cryptographically random?
Yes — Nano ID uses crypto.getRandomValues() in browsers and crypto.randomFillSync() in Node.js. It is not suitable for cryptographic keys but is appropriate for collision-resistant IDs.