Security · PINs
Random PIN generator.
A random 4 to 12 digit PIN, with the option to skip the obvious ones like 0000 and 1234. Made on your device, nothing sent or saved.
How it works
- Random digits: every digit is drawn with
crypto.getRandomValuesand rejection sampling, so 0 to 9 are exactly equally likely. - Skip obvious PINs: when ticked, any PIN made of one repeated digit (0000, 7777) or a straight ascending or descending run (1234, 9876) is discarded and redrawn. That removes only 24 of the 10,000 four-digit PINs, so the entropy figure barely moves, and it is shown for your exact settings.
- Private: no network request and nothing stored.
A PIN is only as safe as the attempt limit
A 4-digit PIN has just 10,000 possibilities (about 13.3 bits), so no choice of digits can protect it against unlimited guessing. Its safety comes from the system that checks it locking or slowing down after wrong tries. NIST SP 800-63B-4 requires verifiers to limit consecutive failed attempts on an authenticator to no more than 100, and explains the figure by comparing it with the chance of guessing a six-digit code. Longer PINs shrink the odds per attempt: six digits is about 19.9 bits and eight about 26.6.
For accounts and anything that can be attacked offline, use a long random password instead: the password generator or the Diceware passphrase generator.
Sources (retrieved 2026-10)
- NIST SP 800-63B-4: verifiers must limit consecutive failed authentication attempts to no more than 100; the limit is explained against the odds of guessing a six-digit decimal code.
How many PINs there are, and what that means
A PIN with n decimal digits has 10n possibilities, so its strength in bits is n × log2(10), about 3.32 bits per digit. The generator prints the exact figure for your settings. The common lengths work out as follows:
- 4 digits: 10,000 PINs, about 13.3 bits.
- 6 digits: 1,000,000 PINs, about 19.9 bits.
- 8 digits: 100,000,000 PINs, about 26.6 bits.
- 12 digits: 1012 PINs, about 39.9 bits.
Compare that with 77.5 bits for six random Diceware words, or about 95 bits for a 16-character random password. A PIN cannot reach those numbers at any practical length, which is exactly why PINs are only used where something else limits the guesses.
Worked example: what an attempt limit buys you
Suppose a system disables the authenticator after 100 consecutive wrong tries, the ceiling NIST SP 800-63B-4 sets for verifiers. An attacker who guesses 100 different PINs at random against a 4-digit PIN has a 100 in 10,000 chance, which is 1%. Against a 6-digit PIN the same 100 attempts have a 100 in 1,000,000 chance, which is 0.01%. Going from four digits to six makes a lucky guess a hundred times less likely without changing anything else. If the system had no limit at all, a program trying a thousand PINs a second would get through all 1,000,000 six-digit PINs in under 17 minutes, which is why you should never use a PIN to protect something that can be attacked offline, such as an encrypted file.
What the "skip obvious PINs" option does
With it ticked, the generator redraws any PIN made of one repeated digit or a straight ascending or descending run. For four digits that removes only 24 of the 10,000 possibilities, so the entropy drops from 13.29 to about 13.28 bits. A random draw is unlikely to produce one of them, but if it does, it is the first thing a person trying PINs by hand would test. The option does not exclude other guessable patterns, such as dates, because a random draw has no way of preferring them.
Why random beats chosen
The numbers above assume every PIN is equally likely. When people choose their own PIN the choices are rarely uniform, so an attacker can try the likeliest ones first and the real search is much smaller than 10,000. A PIN drawn at random from a cryptographic source has no pattern to exploit. This generator draws each digit using the browser's crypto.getRandomValues, which MDN describes as a cryptographically strong random number generator, and discards values that would bias the digits.
Common mistakes
- Regenerating until you get a PIN that looks memorable. Take the first result, or you reintroduce your own bias.
- Using the same PIN for a phone, a bank card and a door code.
- Choosing four digits when the system allows six or more.
- Writing the PIN on the card or device it protects.
- Using a PIN where a passphrase is possible. If the secret can be tried without a limit, use the Diceware passphrase generator or measure options in the Password Entropy Calculator.
Frequently asked questions
How do I generate a random PIN?
Pick the number of digits and press Generate. Each digit is drawn from your browser’s cryptographic random generator, with every digit from 0 to 9 equally likely.
Is a 4-digit PIN safe?
A random 4-digit PIN has 10,000 possibilities, so it is only safe where the system limits wrong guesses. NIST’s authenticator rules cap consecutive failed attempts at no more than 100. Choose 6 or more digits where the system lets you.
Why skip PINs like 0000 and 1234?
They are the easiest PINs to guess by hand. A random PIN has no pattern, but a random draw can land on one of them by chance; the option redraws if it does. It excludes repeated-digit and straight-run PINs only.
Is my PIN stored or sent anywhere?
No. It is made in your browser, no network request is made, and nothing is saved. It disappears when you close the tab.
Can I use this for a bank or phone PIN?
You can use a random PIN anywhere you are allowed to choose one, but follow the issuer’s own rules and never share it. This tool does not know or check where it will be used.
How many possible PINs are there for 4, 6 and 8 digits?
10,000 for four digits, 1,000,000 for six and 100,000,000 for eight. That is about 13.3, 19.9 and 26.6 bits of entropy. Each extra digit multiplies the possibilities by ten.
Is a 6-digit PIN much safer than a 4-digit PIN?
Against guessing limited to a fixed number of attempts, yes. With 100 attempts allowed, a lucky guess succeeds 1% of the time for four digits and 0.01% for six. Both depend on the system actually enforcing the limit.
Sources
- NIST SP 800-63B-4: Authentication and Authenticator Management: verifiers limit consecutive failed attempts to no more than 100 (retrieved 2026-10).
- NIST SP 800-63B-4, Appendix A: Strength of Passwords: strength of short secrets and attempt limits (retrieved 2026-10).
- MDN: Crypto.getRandomValues(): cryptographically strong random values in the browser (retrieved 2026-10).