BcryptGenerator.org

Random PIN Generator

Get a random 4, 6 or 8-digit PIN for your phone, SIM card, bank card or door code. PINs are created in your browser with a cryptographically secure random number generator and skip patterns like 1234 and 0000. Nothing is sent or saved.

 
Number of digits

9,880 possible 4-digit PINs with these settings. Each digit comes from your browser's cryptographically secure random number generator; nothing is sent to a server or saved.

4-digit vs 6-digit PIN: how much safer is it?

Every extra digit multiplies the number of possible PINs by ten. These are the exact numbers for random PINs, and how many the pattern filter removes:

DigitsPossible PINsPatterns skippedChance 3 random guesses succeed
410,000120about 1 in 3,293
61,000,0001,110about 1 in 332,963
8100,000,00010,020about 1 in 33,329,993

A PIN is short, so it relies on the device locking after a few wrong attempts. That is why a random 4-digit PIN is fine for a bank card, while an online account needs a long password. If your phone or app lets you choose, 6 digits gives you 100 times more combinations for two extra taps.

PINs to avoid

Most guessed PINs aren't guessed by luck. People choose numbers that mean something, and attackers try those first:

How this PIN generator works

  • Secure randomness. Each digit comes from crypto.getRandomValues(), your browser's cryptographically secure random number generator, not the predictable Math.random().
  • No bias. Random numbers are mapped to digits with rejection sampling, so every digit from 0 to 9 is exactly equally likely.
  • Patterns skipped, fairly. If a PIN matches a pattern, the generator throws it away and draws a new one, so every remaining PIN is equally likely.
  • Private. PINs are created on your device and never sent anywhere. You can disconnect from the internet after the page loads and it keeps working.

Where to use a random PIN

  • Phone lock screen. iPhones use a 6-digit passcode by default, and Android allows a PIN of 4 digits or more. Choose 6 or more.
  • SIM card PIN. Stops someone using your SIM in another phone. SIM PINs are 4 to 8 digits.
  • Bank and payment cards. Usually 4 digits, changed at your bank's ATM or in its app.
  • Voicemail, door entry and alarm codes, and any account that asks for a numeric PIN.

Use a different PIN for each card and device, never keep it written down with the card, and change it if someone may have seen you enter it.

Need something stronger than a PIN?

For online accounts, use the password generator to create a long random password or passphrase, and check existing ones with the password strength checker.

PIN Generator FAQ

Is a 4-digit PIN secure?+

It can be, because PINs rely on attempt limits rather than size. A phone or bank card that locks after a few wrong tries leaves an attacker with a tiny chance of guessing a random 4-digit PIN: about 0.03% with three tries. The risk comes from PINs that aren't random, such as 1234 or a birth year, which are tried first. Where you can, use 6 digits: that is 100 times more combinations.

What is the most secure PIN?+

There isn't a single "most secure" PIN. Any PIN chosen at random is as strong as any other of the same length; what makes a PIN weak is a pattern or a personal meaning that makes it guessable. That's why the safest PIN is one picked at random, like the ones above, rather than one you choose.

Are the PINs I generate stored or sent anywhere?+

No. Each PIN is created in your browser with the Web Crypto API's secure random number generator. Nothing is sent to a server, logged or saved, and the PIN disappears when you close or refresh the page.

Why does the generator skip some PINs?+

With "skip easy-to-guess patterns" switched on, it never shows PINs made of one repeated digit (0000), a run up or down (1234, 9876, 7890) or a repeated group (1212, 123123). For 4 digits that removes 120 of the 10,000 possible PINs, which barely affects the number of choices but rules out the guesses an attacker tries first.

Should I use a PIN or a password?+

Use a PIN where the device itself limits wrong attempts, such as a phone lock screen, a SIM card or a bank card. For online accounts, where an attacker might make many guesses, use a long random password instead, from the password generator.

Can I generate several PINs at once?+

Yes. Choose 5, 10 or 20 under "How many" and use Copy to copy them all, one per line. That is handy for setting up several devices or giving each person on a team their own PIN.