NanoID Generator
Generate NanoID strings in your browser. Choose the length and alphabet, create a single ID or a bulk batch, and copy the results. Every ID uses your device's secure random source.
How to generate a NanoID
- Set the ID size and pick an alphabet, or keep the URL-safe default.
- Choose how many IDs you want, from 1 up to 1000.
- Click Generate, then copy a single ID or the whole list.
Examples
A default 21-character NanoID
size: 21
V1StGXR8_Z5jdHi6B-myT
Frequently asked questions
What is a NanoID?
NanoID is a tiny, secure, URL-friendly unique string ID. By default it is 21 characters long using a 64-symbol alphabet of A-Z, a-z, 0-9, plus '-' and '_', so it is safe to drop into URLs, filenames and database keys.
NanoID vs UUID - which should I use?
A v4 UUID is a fixed 36-character format with 122 bits of randomness. A default NanoID is shorter at 21 characters with about 126 bits, so it is more compact for the same collision safety. Use UUID when a standard format is required, and NanoID when you want shorter, cleaner IDs.
Are the generated IDs unique?
Practically, yes. A 21-character default NanoID has roughly 126 bits of entropy, so the odds of two colliding are vanishingly small even at billions of IDs. This tool also keeps every ID in a batch distinct.
How are the IDs randomised?
Each ID is built from your browser's cryptographic random source, crypto.getRandomValues. To avoid bias when the alphabet size is not a power of two, the tool uses rejection sampling with a bitmask, the same technique as the NanoID library, so every symbol is equally likely.
Can I change the length or the alphabet?
Yes. Set any size from 1 to 256 characters and supply any alphabet from 2 to 256 symbols. Built-in presets cover URL-safe, alphanumeric, lowercase, numbers and hex. A shorter alphabet or size means fewer bits of entropy, which the collision note reflects.
Is anything sent to a server?
No. Every NanoID is generated locally in your browser, so the values never leave your device. Refresh the page and they are gone.
Related tools
UUID Generator
Generate random version 4 UUIDs online. Create one or thousands at once, with uppercase or no-hyphen options, then copy them. Free and private.
ULID Generator
Generate ULIDs online: time-sortable, 26-char Crockford base32 IDs. Make one or thousands, copy them, or decode a ULID to its timestamp. Free and private.
Token Generator
Generate secure random tokens online in hex, base64url or base64. Great for API keys, secrets and CSRF tokens. Runs in your browser, nothing stored.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.