ProtemKey

Making strong secrets · 5 min read

PINs explained: why four digits can be enough

A PIN has very few possibilities, so its safety comes from the device or service refusing to let anyone guess more than a handful of times. Without that limit, any PIN falls almost instantly.

A four-digit PIN has only 10,000 possible values. By the standards of the rest of this site that is tiny: a computer could try them all in well under a second. Yet PINs protect bank cards, phones and security keys every day. The reason is that a PIN’s strength doesn’t come from the number of possibilities alone. It comes from the number of possibilities combined with how many guesses an attacker is allowed.

Counting a PIN

Each random digit is one of 10, worth log2(10) = 3.322 bits.

PIN length Possibilities Bits
4 digits 10,000 13.29
6 digits 1,000,000 19.93
8 digits 100,000,000 26.58

Every added digit multiplies the possibilities by 10. Compare a single word from the EFF passphrase list at 12.925 bits: a random four-digit PIN is worth about the same as one random word.

The guess limit is the real protection

NIST SP 800-63B-4 calls a PIN or password that unlocks a device locally an activation secret, and treats it differently from a password sent to a server. For activation secrets it says:

  • Devices “SHALL require the secrets to be at least four characters in length and SHOULD require the secrets to be at least six characters in length.” Activation secrets “MAY be entirely numeric (i.e., a PIN).”
  • The device or verifier “SHALL implement a retry-limiting mechanism that limits the number of consecutive failed activation attempts using the authenticator to no more than 10.” After that, “the authenticator SHALL be disabled.”
  • The device “SHOULD implement a blocklist to discourage subscribers from selecting commonly used activation secrets (e.g., 123456).”

NIST’s Appendix A explains why the rules are relaxed for local verification: the threats there, physical tampering and malware on the device, “are less dependent on the length and complexity of the password,” and “Throttling is the primary defense against online attacks.”

Worked example: ten tries

Suppose a device allows 10 wrong attempts before locking, and the PIN was chosen uniformly at random.

  • 4 digits: an attacker who tries 10 different PINs has a 10 ÷ 10,000 = 0.1% chance, 1 in 1,000.
  • 6 digits: 10 ÷ 1,000,000 = 0.001%, 1 in 100,000.

That’s why a short PIN can be acceptable: the attacker never gets to the thousands of guesses they would need.

Now remove the limit. At the site’s illustrative online rate of 100 guesses per hour, a random 4-digit PIN is found after about 50 hours on average, roughly 2.1 days. At an offline rate of 10,000 guesses per second, every 4-digit PIN can be tried in 1 second and every 6-digit PIN in 100 seconds. Without a guess limit, no PIN is strong.

Random PINs. The chance assumes the PIN was chosen uniformly at random; chosen PINs (dates, patterns) are hit far sooner.
DigitsBitsPossible PINsHit in 10 guessesHit in 100 guesses
413.310,0000.1%1%
516.6100,0000.01%0.1%
619.91,000,0000.001%0.01%
723.310,000,0000.0001%0.001%
826.6100,000,0001e-05%0.0001%
929.91,000,000,0001e-06%1e-05%
1033.210,000,000,0001e-07%1e-06%
1136.5100,000,000,0001e-08%1e-07%
1239.91,000,000,000,0001e-09%1e-08%

Human-chosen PINs are much weaker

The figures above assume a random PIN. People choose PINs the way they choose passwords: repeated digits, straight runs like 1234, years, birthdays, patterns on the keypad. Attackers try those first, which is why NIST recommends a blocklist.

Worked example: a birthday PIN

Suppose an attacker suspects a 4-digit PIN is a date in month-day form (MMDD). There are only 366 valid dates, including February 29.

  • Possibilities: 366, or log2(366) = 8.52 bits, instead of 13.29.
  • With 10 guesses, the chance of hitting a specific unknown date is 10 ÷ 366 ≈ 2.7%, 27 times the 0.1% for a random PIN.
  • If the attacker knows the person’s birthday, from a document in the same wallet or a public profile, it can take one guess.

The same reasoning applies to years (a PIN like 1987 is one of about 100 likely years) and to PINs that spell a pattern on the keypad.

What “avoid obvious PINs” costs

This site’s PIN generator has an option to exclude obvious PINs: repeated digits, straight runs up and down, and entries on a common-PIN list. Excluding them makes the PIN space slightly smaller, and the generator reports the exact bits of what remains.

The cost is tiny. Removing just the repeats (0000 to 9999, 10 PINs) and the straight runs (0123 to 6789 and 9876 to 3210, 14 PINs) from 4-digit PINs leaves 9,976, which is log2(9,976) = 13.284 bits, against 13.288 with everything allowed. Even removing 100 PINs costs only about 0.015 bits. In return, you avoid exactly the values an attacker tries first, which matters more when only a few guesses are allowed.

Where PINs are used, and what that means

  • Device unlock and security keys. The PIN is checked on the device itself and protected by a retry limit, often enforced by dedicated hardware. A short random PIN is reasonable here; six digits gives a hundredfold margin over four.
  • Payment cards. Also limited by a small number of attempts before the card is blocked. The number of attempts varies by issuer.
  • PINs as account passwords. Some services let a numeric code act as the login password itself. Its safety then depends entirely on the service’s rate limiting and on how it stores the code. If a stored copy leaks, a PIN offers almost no protection against offline guessing at any length a person would type.
  • Encryption. A PIN should not be the only thing protecting encrypted data that could be copied off the device, because nothing limits guesses against a copy. Devices that do use PINs here rely on hardware that holds the key and enforces the limit.

Longer PINs and alphanumeric codes

Where a device allows it, longer PINs raise the margin: 8 digits gives 1 in 10 million odds over 10 guesses. Many devices also accept letters, in which case the “PIN” becomes a short password and the bits per character rise (4.700 for lowercase, 5.954 for letters and digits). NIST says that, where an activation secret is not purely numeric, all printing ASCII characters, the space and Unicode characters should be permitted.

Note: A PIN’s strength is a property of the whole system: the number of possibilities, the retry limit, and whether a copy can be attacked offline. The same 4 digits can be fine on a locking device and useless as a stored login code.

For how the bits of any secret are counted, see entropy explained.

Sources

  1. NIST SP 800-63B-4, Digital Identity Guidelines: Authentication and Authenticator Management (2025)

General explanation, not advice for a particular situation. Updated 2026-10-31.