A Nano ID generator creates cryptographically random, URL-friendly identifiers, and the Nano ID Generator creates 1–100 IDs with lengths from 1–128 characters entirely in your browser.
These identifiers work well for application record keys, job references, public document IDs, and other values that must pass through URLs, APIs, logs, or exported data without awkward escaping. They are non-sequential and do not reveal creation time, record type, region, shard, or business meaning. The output uses newline-delimited text, so a generated batch can move directly into an application workflow without being uploaded to a server.

Generate a copy-ready Nano ID batch
- Open the Nano ID Generator, choose an ID length from 1 through 128 characters, and select a quantity from 1 through 100. The default length is 21 characters, matching the Nano ID project's normal API.
- Generate the batch. The browser cryptographic random source supplies the random bytes, and the generator selects characters from the official 64-symbol Nano ID alphabet.
- Copy the newline-delimited IDs and enforce uniqueness again in your durable data store. The tool checks the current batch for duplicates and reports an error if one appears, but its local check cannot coordinate with other tabs, devices, processes, deployments, or earlier sessions.
How the generator avoids biased symbols
The official alphabet contains uppercase letters, lowercase letters, digits, underscore, and hyphen. It excludes characters such as slash, plus, equals, and whitespace that commonly require URL escaping. The official Nano ID repository remains the reference for ecosystem compatibility and the alphabet definition.
Randomness alone does not guarantee an even distribution of symbols. A direct modulo mapping can bias character selection whenever the available random range is not evenly divisible by the alphabet size. This implementation instead uses a computed bit mask and rejection sampling: masked random values outside the alphabet are discarded, and new values are drawn until the requested identifier is complete.
The underlying source is window.crypto.getRandomValues, the Web Crypto primitive described by the W3C getRandomValues specification. The generator does not use Math.random, timestamps, counters, browser fingerprints, or a deterministic seed. That makes the output difficult to predict, although a random ID is not automatically a secret or an authorization mechanism.
With a 64-symbol alphabet, each character represents six bits of randomness. At the default length, 21 characters × 6 bits per character = 126 bits of random space before application behavior. Shortening an ID reduces that space exponentially, so the trade-off deserves attention as the collection grows.
Make the database the final uniqueness authority
A duplicate check inside the generator is useful because it catches an improbable repeat before the batch reaches your application. It is not a distributed coordination mechanism, however, and it cannot know about values already stored by another process or created in an earlier deployment. The durable store must remain the final authority.
| Layer | Responsibility | Boundary |
|---|---|---|
| Generator batch check | Rejects a duplicate found within the newly generated batch. | Does not coordinate with other tabs, devices, processes, or past sessions. |
| Application create transaction | Inserts the ID and handles a uniqueness conflict atomically. | Should retry only the failed creation transaction, not the entire batch. |
| Database unique constraint | Enforces uniqueness in the durable store. | Does not coordinate separate databases or unrelated data stores. |
Checking for a value and inserting it later creates a race window: two requests can pass the check before either one is stored. A database unique constraint closes that gap by rejecting the conflicting insert. Your creation code should catch that rejection and retry only the failed transaction, preferably with an appropriate backoff policy.
Length controls the available identifier space, but no chosen length is guaranteed to be collision-free. Before moving away from the 21-character default, consider expected issuance volume, acceptable collision risk, retry behavior, how long records remain stored, and whether identifiers are exposed to adversarial users. A larger batch can also contain more opportunities for a conflict, so generating more IDs does not remove the need for durable enforcement.
Match the identifier format to the job
No random ID format is ideal for every requirement. Choose the format that matches the behavior your system actually needs instead of treating every identifier as interchangeable.
| Requirement | Suitable choice | Reason |
|---|---|---|
| Compact, URL-friendly application record ID | Nano ID | Uses a URL-friendly alphabet and does not imply time or business meaning. |
| A required RFC 4122 version 4 representation | UUID Generator | Choose UUID v4 when an external system or interoperability standard specifically requires that format. |
| Time-oriented or lexicographic ordering | ULID Generator | ULID supports a different ordering model; a random Nano ID does not encode chronology. |
| Password, API key, recovery code, or signing material | A dedicated platform credential generator | Credentials require separate generation, storage, rotation, access, and exposure controls. |
For example, a public record URL can use a Nano ID without implying when the record was created. If another service requires a UUID v4, use that format instead of trying to reinterpret random Nano ID characters. Conversely, if operators need IDs that sort in time-oriented order, choose a format designed for that purpose rather than deriving order from random text.
Treat the ID as data, not authorization
Randomness makes an identifier difficult to guess, but it does not decide who may read or change the associated record. Access control must remain independent of whether an ID appears random. Keep authorization checks on the server or other trusted enforcement point, and do not treat possession of an identifier as proof of permission.
Generation and copying happen locally in the current tab. The page sends no identifier, count, length, clipboard content, random byte, or usage event to a server. That limits server-side exposure, but browser extensions, compromised scripts, and a compromised device can still observe page data. For that reason, this generator should not create passwords, API keys, recovery codes, signing material, or other high-value secrets. Use the target platform's dedicated credential generator and secure storage for those jobs.
Integration checklist before shipping
- Keep the 21-character default unless a measured requirement justifies another length.
- Store IDs in a column that preserves case, underscore, and hyphen exactly.
- Add a unique constraint and handle conflicts atomically inside the creation transaction.
- Test every route, log processor, analytics system, CSV export, and database collation that handles the ID.
- Do not infer chronology, record type, region, shard, or creation order from a Nano ID.
- Keep authorization and access control independent from identifier unpredictability.
For a straightforward application workflow, open the generator, retain the default length, produce the required batch, copy the newline-delimited results, and insert each value through a unique-constrained transaction. That process combines locally generated URL-friendly IDs with the durable checks needed for reliable data storage.