How to use the passcode generator
- Select Numeric for a standard PIN or Alphanumeric for letters and digits.
- Set the Length between 4 and 12 characters.
- Check No repeated adjacent characters or No sequences if you want to filter out weak patterns like
1122or1234. - Choose how many codes to generate (up to 100) and click Generate.
How the passcode generator works
The tool builds each code character by character using crypto.getRandomValues, which provides cryptographically secure randomness directly in the browser. For a numeric passcode, the pool contains the ten digits 0 through 9. For an alphanumeric code, it uses the 26 uppercase English letters plus the 10 digits, giving a pool of 36 characters.
When you enable the no-repeats filter, the generator rejects any randomly chosen character that matches the one immediately before it and draws again. The no-sequences filter checks whether the last three characters form a run of consecutive values in either direction. For example, in the numeric set, 345 and 765 are rejected. In the alphanumeric set, the sequence check applies only to digits; letter runs like ABC are allowed because they do not represent the same predictable keypad pattern.
The no-repeats filter only blocks identical neighbours, so it works at every length, including 12 digits (for example 482901637251). If the filters ever make a code impossible to build, the tool returns an error rather than looping forever.
Number of possible combinations
The total number of unique codes depends on the character pool size and the length. Without any filters applied, the formula is simply pool size raised to the power of the length. Here is a reference table for common configurations:
| Type | Length | Pool size | Total combinations |
|---|---|---|---|
| Numeric PIN | 4 | 10 | 10,000 |
| Numeric PIN | 6 | 10 | 1,000,000 |
| Numeric code | 8 | 10 | 100,000,000 |
| Alphanumeric | 4 | 36 | 1,679,616 |
| Alphanumeric | 6 | 36 | 2,176,782,336 |
| Alphanumeric | 8 | 36 | 2,821,109,907,456 |
Enabling the no-repeats or no-sequences filters reduces these totals slightly, but the remaining pool is still large enough for practical security in most non-cryptographic contexts.
Practical uses for random PINs
A random 6 digit number is commonly used as a one-time verification code sent via SMS or email. Because humans tend to pick memorable numbers when asked to invent a PIN, a passcode generator removes that bias and produces codes that are harder to guess.
- Two-factor authentication: Temporary numeric codes for login verification.
- Device locks: Setting a phone or tablet PIN that avoids birthdays or repeated digits.
- Event ticketing: Generating unique alphanumeric entry codes for attendees.
- Testing: Developers often need bulk lists of random PINs to populate test databases or simulate user input.
For longer secrets that include lowercase letters and symbols, consider a dedicated password generator instead. If you need to encode data rather than generate access codes, tools like Base64 encoding or a hash generator serve different purposes.
Why filter repeats and sequences
Research into real-world PIN usage shows that a small fraction of possible codes accounts for a large share of actual choices. Codes like 1234, 0000, and 1111 appear far more often than probability would predict. An attacker who knows this can try the most popular patterns first.
The no-repeats filter prevents adjacent identical characters, eliminating codes like 112233. The no-sequences filter blocks runs of three or more ascending or descending values, removing patterns like 123, 456, or 987. Together, these filters remove the weakest candidates while preserving uniform distribution among the remaining possibilities.
Note that filtering does reduce entropy slightly. For a 4-digit numeric PIN with no repeats and no sequences, the valid pool shrinks from 10,000 to 7,016 combinations. That is still sufficient for short-lived verification codes, but for high-security applications you should increase the length rather than rely solely on filters.
Uniformity and randomness guarantees
Each character position is filled by an independent draw from the character pool using rejection sampling. When a drawn character violates an active filter rule, it is discarded and another random value is selected. This approach maintains a uniform distribution across all valid outputs: every permissible code has exactly the same probability of being generated.
The underlying source of randomness is the Web Crypto API (crypto.getRandomValues), which draws from the operating system's cryptographic random number generator. This is the same source used for TLS session keys and is suitable for generating security-sensitive tokens. Unlike Math.random(), it is not a pseudorandom sequence that can be predicted from prior outputs.
Worked examples
| Example | Input | Result |
|---|---|---|
| Random 6 digit number | Character set: numeric; Length: 6; No repeated adjacent characters: no; No ascending or descending sequences (3+): no; How many to generate: 1 | Passcode: 967167; Length: 6; Character set: Numeric (0-9); Filters applied: None |
| Four-digit PIN, no repeats | Character set: numeric; Length: 4; No repeated adjacent characters: yes; No ascending or descending sequences (3+): no; How many to generate: 5 | Codes generated: 5; Length: 4; Character set: Numeric (0-9); Filters applied: No adjacent repeats |
| 8-character alphanumeric code | Character set: alphanumeric; Length: 8; No repeated adjacent characters: no; No ascending or descending sequences (3+): no; How many to generate: 1 | Passcode: ICWZDPYL; Length: 8; Character set: Alphanumeric (A-Z, 0-9); Filters applied: None |
| Bulk 4-digit PINs, filtered | Character set: numeric; Length: 4; No repeated adjacent characters: yes; No ascending or descending sequences (3+): yes; How many to generate: 10 | Codes generated: 10; Length: 4; Character set: Numeric (0-9); Filters applied: No adjacent repeats, No sequences |
FAQ
Is this passcode generator secure?
Yes. It uses the Web Crypto API for randomness, which is cryptographically secure. The codes are generated entirely in your browser and are never transmitted over the network.
What is the difference between numeric and alphanumeric?
Numeric uses only digits 0 through 9, producing a standard PIN. Alphanumeric adds uppercase letters A through Z, creating a larger pool of 36 characters per position for stronger codes.
Can I generate a 12-digit numeric code with no repeats?
Yes. The no-repeats filter only blocks identical neighbouring characters, so digits can still appear more than once in a code (for example 482901637251).
Can I use this as a random 6 digit number generator?
Yes. Set the character set to Numeric, the length to 6, leave the filters unchecked, and click Generate. Each result is a uniformly distributed random 6 digit number.
How many codes can I generate at once?
You can request up to 100 codes in a single batch. Each code is generated independently, so duplicates across the list are possible unless you manually remove them.
Does the sequence filter block letters like ABC?
No. The sequence filter only checks for consecutive numeric digits like 123 or 765. Letter sequences are allowed because they do not follow the same predictable keypad patterns.