Random 6 Digit Number Generator
Generate cryptographically secure random 6-digit numbers (100000-999999). Unique or repeatable, bulk generation up to 10,000 numbers instantly.
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.
Formulas
A cryptographically secure 6-digit number is produced via rejection sampling over the Web Crypto API output:
The raw 32-bit unsigned integer is mapped to the target range using rejection to avoid modulo bias:
limit = 232 ā (232 mod range)
if raw ā„ limit ā reject, redraw
result = (raw mod range) + 100000
Entropy per 6-digit number:
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 Count | Range | Total Possible Values | Bits of Entropy | Common Use Cases |
|---|---|---|---|---|
| 1 | 0 - 9 | 10 | 3.32 | Single digit index |
| 2 | 10 - 99 | 90 | 6.49 | Short codes |
| 3 | 100 - 999 | 900 | 9.81 | Area codes, CVV |
| 4 | 1000 - 9999 | 9,000 | 13.14 | PIN codes, years |
| 5 | 10000 - 99999 | 90,000 | 16.46 | ZIP codes (US) |
| 6 | 100000 - 999999 | 900,000 | 19.78 | OTP, verification codes |
| 7 | 1000000 - 9999999 | 9,000,000 | 23.10 | Phone numbers (local) |
| 8 | 10000000 - 99999999 | 90,000,000 | 26.42 | Account numbers |
| 9 | 100000000 - 999999999 | 900,000,000 | 29.74 | SSN (US), routing numbers |
| 10 | 1000000000 - 9999999999 | 9,000,000,000 | 33.07 | Phone numbers (intl) |
| 12 | 1011 - 1012ā1 | 9Ć1011 | 39.71 | UPC barcodes |
| 16 | 1015 - 1016ā1 | 9Ć1015 | 52.99 | Credit card numbers |