• Practice
  • About 13 min
  • 5 practice questions

Password strength and counting combinations

Count possible PINs and passwords, compare the effect of length and character set, and work out simple guessing-time questions.

If something looks wrong, please tell us.

Strong passwords are not just advice; they are mathematics. The more possible passwords there are, the longer a guessing attack takes. Some exams ask you to count combinations or compare two password rules. The method is always the same: multiply the number of choices for each position.

The counting rule

If each position in a password can be filled in n ways and there are L positions, the number of possible passwords is n multiplied by itself L times, written n to the power L. Here n is the size of the character set: 10 for digits, 26 for lowercase letters, 52 for upper and lower case letters, 62 when digits are added to those letters.

Number of possible passwords
Password typeChoices per position (n)Length (L)Possibilities
PIN of digits10410,000
PIN of digits1061,000,000
Lowercase letters266308,915,776
Letters and digits (both cases)62656,800,235,584
Lowercase letters268208,827,064,576

What the table shows

  • Adding two digits to a PIN (4 to 6) multiplies the possibilities by 100.
  • Moving from lowercase letters only to letters and digits (26 to 62 choices) at the same length 6 makes the count about 184 times larger (56,800,235,584 divided by 308,915,776).
  • Length is powerful: eight lowercase letters beat six characters drawn from all 62.
  • Real people choose names, birthdays and words, so real passwords are easier to guess than the counts suggest. That is why random or long passphrases are advised.

Worked examples

Example 1. How many different 3-letter codes can be made from the 26 lowercase letters if letters may repeat? 26 x 26 x 26 = 17,576 codes.

Example 2. A system asks for a 4-digit PIN and locks after 3 wrong attempts. What is the chance that a random guesser opens it? There are 10,000 PINs. Three attempts try three of them, so the chance is 3 out of 10,000, which is 0.03%. This shows the value of an account lockout.

Example 3. Suppose, only as an illustration, that a program tests 1,000 passwords every second. How long to try every 6-digit PIN? There are 1,000,000 PINs. Time = 1,000,000 divided by 1,000 = 1,000 seconds, which is about 16.7 minutes. A 4-digit PIN would take 10,000 divided by 1,000 = 10 seconds. The speed of 1,000 per second is an assumption for practice, not a real measurement.

Example 4. Rule A: 6 characters, digits only. Rule B: 4 characters, letters (both cases) and digits. Which gives more possibilities? Rule A: 10 to the power 6 = 1,000,000. Rule B: 62 to the power 4 = 14,776,336. Rule B has more, even though it is shorter, because its character set is larger. So length alone does not decide; compare the actual counts.

Possibilities = (choices per position) to the power (length).

— Remember

Good practice

  • Use a long passphrase of several unrelated words, or a random string from a password manager.
  • Use a different password for each important account.
  • Add a second factor so that a guessed password alone is not enough.
  • Never use names, birthdays, '12345' or 'password'.

Key takeaways

  • Count = n to the power L.
  • Both length and character set matter; compute before you compare.
  • Lockouts and second factors protect even weak PINs.

Check your understanding

  1. 1. How many 3-digit codes (000 to 999) exist?

    1. 1,000
    2. 999
    3. 100
    4. 10,000
    Show answer

    Answer: A. Each of the 3 positions has 10 choices, so 10 x 10 x 10 = 1,000 codes.

  2. 2. Moving from a 4-digit PIN to a 6-digit PIN multiplies the possibilities by

    1. 2
    2. 100
    3. 10
    4. 1,000
    Show answer

    Answer: B. 10,000 becomes 1,000,000, which is 100 times larger.

  3. 3. How many 2-letter codes can be made from 26 lowercase letters with repetition allowed?

    1. 676
    2. 52
    3. 26
    4. 702
    Show answer

    Answer: A. 26 x 26 = 676.

  4. 4. Which rule allows the most possible passwords?

    1. 5 characters, digits only
    2. 3 characters, letters and digits
    3. 4 characters, lowercase only
    4. 6 characters, digits only
    Show answer

    Answer: D. Counts: 10 to the 5th = 100,000; 62 cubed = 238,328; 10 to the 6th = 1,000,000; 26 to the 4th = 456,976. Six digits gives the largest number, 1,000,000.

  5. 5. If a PIN has 10,000 possibilities and a lockout allows 5 attempts, the chance of a lucky random guess is

    1. 0.5%
    2. 5%
    3. 0.05%
    4. 50%
    Show answer

    Answer: C. 5 divided by 10,000 = 0.0005, which is 0.05%.

Privacy · Terms · Refunds · Delivery