User Rating 0.0 ā˜…ā˜…ā˜…ā˜…ā˜…
Total Usage 0 times
1 – 10,000
Quick presets:
Is this tool helpful?

Your feedback helps us improve.

ā˜… ā˜… ā˜… ā˜… ā˜…

About

A 6-digit number occupies the range 100000 to 999999, yielding exactly 900,000 possible values. Selecting uniformly from this space matters. Math.random() in most JS engines uses xorshift128+ which is deterministic and predictable given enough samples. This tool uses the Web Crypto API (crypto.getRandomValues), a CSPRNG seeded by OS entropy, making output suitable for PINs, verification codes, lottery picks, and test data where statistical bias or predictability constitutes a real risk. Rejection sampling eliminates modulo bias that would otherwise skew the distribution toward lower values.

The generator supports bulk output up to 10,000 numbers with optional uniqueness enforcement. When uniqueness is active, the tool draws from the pool of 900,000 distinct values using a Set for O(1) collision detection. Note: requesting more than 900,000 unique 6-digit numbers is mathematically impossible. Results can be copied or exported as plain text. This tool approximates true randomness under the assumption that the browser's entropy source is healthy.

random number generator 6 digit number random number number generator secure random bulk random numbers

Formulas

A cryptographically secure 6-digit number is produced via rejection sampling over the Web Crypto API output:

raw = crypto.getRandomValues(Uint32Array[1])[0]

The raw 32-bit unsigned integer is mapped to the target range using rejection to avoid modulo bias:

range = 900000
limit = 232 āˆ’ (232 mod range)
if raw ≄ limit → reject, redraw
result = (raw mod range) + 100000

Entropy per 6-digit number:

H = log2(900000) 19.78 bits

Where raw is a uniformly distributed 32-bit unsigned integer from the OS CSPRNG, range is the count of valid 6-digit numbers (999999 āˆ’ 100000 + 1), limit is the rejection threshold that eliminates modulo bias, and H is the Shannon entropy in bits per generated number.

Reference Data

Digit CountRangeTotal Possible ValuesBits of EntropyCommon Use Cases
10 - 9103.32Single digit index
210 - 99906.49Short codes
3100 - 9999009.81Area codes, CVV
41000 - 99999,00013.14PIN codes, years
510000 - 9999990,00016.46ZIP codes (US)
6100000 - 999999900,00019.78OTP, verification codes
71000000 - 99999999,000,00023.10Phone numbers (local)
810000000 - 9999999990,000,00026.42Account numbers
9100000000 - 999999999900,000,00029.74SSN (US), routing numbers
101000000000 - 99999999999,000,000,00033.07Phone numbers (intl)
121011 - 1012āˆ’19Ɨ101139.71UPC barcodes
161015 - 1016āˆ’19Ɨ101552.99Credit card numbers

Frequently Asked Questions

When mapping a 32-bit integer (range 0-4,294,967,295) to 900,000 values, naive modulo produces bias because 2^32 is not evenly divisible by 900,000. The remainder (2^32 mod 900,000 = 167,296) means the first 167,296 values appear with probability slightly higher than the rest. This tool computes a rejection threshold: any raw value ≄ (2^32 āˆ’ 167,296) is discarded and redrawn. The probability of rejection is ~0.004%, so performance impact is negligible while ensuring perfectly uniform distribution.
Exactly 900,000. The 6-digit range spans 100000 to 999999 inclusive. If you request more than 900,000 unique numbers, the tool will cap the request and notify you. In practice, generating above ~100,000 unique values will slow down due to increasing collision rates in the Set lookup, though the tool handles this efficiently.
It is a cryptographically secure pseudorandom number generator (CSPRNG) seeded by operating system entropy sources (hardware interrupts, thermal noise, etc.). It is not truly random in the quantum sense, but it is computationally indistinguishable from true randomness. It meets NIST SP 800-90A requirements and is suitable for cryptographic key generation, making it more than adequate for 6-digit number generation.
No. By definition, a 6-digit number ranges from 100000 to 999999. Numbers starting with zero (e.g., 012345) are 5-digit numbers with a leading zero, which is a string representation, not a 6-digit integer. This tool generates integers in the strict 6-digit range. If you need zero-padded 6-character strings, you would need a different tool.
The tool uses a JavaScript Set for O(1) average-case insertion and lookup. For 10,000 unique numbers from a pool of 900,000, the expected collision rate is approximately 1.1% (birthday problem approximation: n²/2m where n=10,000 and m=900,000). This means roughly 110 extra draws per 10,000 numbers - negligible overhead. At 100,000 numbers, the collision rate rises to ~11%, still manageable. The algorithm degrades gracefully rather than failing.
The tool supports newline, comma, space, semicolon, and tab separators. Results can be copied to clipboard or downloaded as a .txt file. The separator choice affects both the on-screen display and the exported content. For CSV import into spreadsheets, use comma separator. For line-by-line processing, use newline.