What is Nano ID?
Nano ID is a compact, URL-friendly unique identifier generator.
It produces random strings using the alphabet A-Za-z0-9_-
(64 characters), powered by the Web Crypto API for cryptographic security.
The default length of 21 characters provides approximately 126 bits of entropy, comparable to UUIDv4's 122 bits but in a much shorter string. Unlike UUIDs, Nano IDs contain no hyphens, no version bits, and no fixed structure, making them ideal for use in URLs, filenames, and HTML attributes.
Nano ID vs UUID
| Feature | Nano ID | UUIDv4 |
|---|---|---|
| Default length | 21 chars | 36 chars |
| Entropy | ~126 bits | 122 bits |
| URL-safe | Yes (no encoding needed) | Yes (but longer) |
| Configurable length | Yes (4-128+) | No (fixed 36) |
| Standard / RFC | No | RFC 4122 |
Frequently Asked Questions
- How long should my Nano ID be?
- The default 21 characters is suitable for most applications. For very high-throughput systems, consider 24+ characters. For short-lived or low-volume use cases like invite codes, 10-12 characters may be enough.
- Is Nano ID cryptographically secure?
- Yes. Nano ID uses
crypto.getRandomValues()in the browser andcrypto.randomBytes()in Node.js. - Is my data sent to a server?
- No. Nano IDs are generated entirely in your browser. Nothing is sent to any server.