Nano ID Generator
Generate up to 100 cryptographically random Nano ID-compatible strings with a validated length from 1 to 128 characters.
Privacy: your files never leave your device. All processing happens locally in your browser.
How to use
- 1.Choose an ID length from 1 to 128 and a quantity from 1 to 100.
- 2.Generate the batch with the browser cryptographic random source.
- 3.Copy the newline-delimited IDs and enforce uniqueness again in your durable data store.
About Nano ID Generator
Nano ID Generator creates URL-friendly random identifiers in the browser using the official 64-symbol Nano ID alphabet: uppercase letters, lowercase letters, digits, underscore, and hyphen. Choose a length from 1 through 128 and a quantity from 1 through 100, then generate a batch. The default length is 21 characters, matching the Nano ID project's normal API. Every result stays in the current tab and can be copied as newline-delimited text.
The random source is window.crypto.getRandomValues, the Web Crypto API primitive intended to provide cryptographically strong random bytes. The generator does not call Math.random, derive values from timestamps, counters, browser fingerprints, or a deterministic seed. That distinction matters when identifiers must be difficult to predict. It still does not turn an identifier into authentication, authorization, encryption, or a secret-management system. Access control must remain independent of whether an ID appears random.
Uniform symbol selection requires more than taking a random byte modulo the alphabet length. Modulo reduction creates bias whenever the range of random values is not evenly divisible by the alphabet size. This implementation follows Nano ID's rejection-sampling approach: it builds a bit mask, ignores masked values outside the alphabet, and keeps drawing until the requested length is complete. The default alphabet has 64 unique symbols, so its indices fit exactly in six bits. Tests lock representative alphabet indices and enforce all size and quantity bounds.
Length controls the identifier's available random space. With a 64-symbol alphabet, each character represents six random bits, so the default 21-character value carries 126 bits before considering application behavior. Shortening an ID reduces the space exponentially and raises collision probability as a collection grows. The page does not promise that any chosen length is collision-free. Evaluate expected issuance volume, acceptable risk, retry behavior, storage lifetime, and adversarial exposure before changing the default.
A generated batch is checked for duplicates before display. If an extremely unlikely duplicate appears within the same batch, the tool reports an error instead of silently returning it. That local check does not coordinate with IDs generated in other tabs, devices, processes, deployments, or earlier sessions. A database should still enforce a unique constraint, and creation code should handle a conflict atomically. Checking first and inserting later is subject to race conditions; let the durable store be the final authority.
Nano ID strings are convenient in URLs because the default alphabet avoids slash, plus, equals, whitespace, and other characters that often need escaping. They are not sequential and do not encode time, region, shard, record type, or creation order. If your system requires lexicographic time ordering, offline decoding, or a standardized UUID representation, choose a format designed for that purpose. Do not infer chronology or business meaning from random characters.
Generation and copying are client-only. No identifier, count, length, clipboard content, random byte, or usage event is sent to a server. Browser extensions, compromised scripts, and a compromised device can still observe page data, so do not generate passwords, API keys, recovery codes, signing material, or high-value secrets here. Use the target platform's dedicated credential generator and secure storage for those jobs.
For reliable integration, retain the 21-character default unless a measured requirement justifies another length, store the value in a column that preserves case and both punctuation characters, add a unique constraint, and retry only the failed creation transaction. Test every route, log processor, analytics system, CSV export, and database collation that handles the ID. The official Nano ID project remains the authority for ecosystem compatibility; the W3C Web Crypto specification anchors the browser random primitive used by this dependency-free implementation.
Methodology & sources
Uses Web Crypto random bytes, Nano ID's official 64-symbol URL alphabet, a computed mask, and rejection sampling to avoid modulo bias. It validates length 1..128 and quantity 1..100, fails malformed random sources, and rejects duplicate values within a generated batch.
Frequently asked questions
- Is the default 21-character Nano ID guaranteed never to collide?
- No random identifier is absolutely collision-free. The default provides a very large space, but applications should still enforce a database unique constraint and handle conflicts atomically.
- Can I use these IDs as passwords or API keys?
- No. Random identifiers and credentials have different lifecycle, storage, rotation, and exposure requirements. Use the target system's dedicated secret generator and manager.
- Why not use Math.random or byte modulo alphabet length?
- Math.random is not a cryptographic source, and naive modulo mapping can bias symbols. This tool uses Web Crypto bytes with rejection sampling.
Related tools
- UUID GeneratorGenerate cryptographically random RFC 4122 v4 UUIDs in bulk β copy one or all, in your browser.
- Random Number GeneratorGenerate fair random integers from your chosen inclusive range without sending any values to a server.
- Random Letter GeneratorInstantly generate random letters with control over case, count, vowels or consonants, and repeats.
- Base64 Encode / DecodeEncode or decode Base64 instantly with full UTF-8 support β emoji and accents work, all in your browser.
- ANSI Color Codes GeneratorBuild and copy raw SGR escape sequences and search the standard 8 plus bright 8 terminal color codes.
- ASCII TableLook up every standard 7-bit ASCII code with exact decimal, hexadecimal, octal, and binary values.