Find a course

Module 1: How Accounts Get CompromisedLesson 2 of 1113 min

How Passwords Are Cracked

Understand online versus offline attacks, hashing and salting, and how attacker speed and length decide if a password lasts seconds or centuries.

Step 1 of 12Learn

Two very different attacks

Imagine an attacker trying to get into your account. There are two situations, and they're worlds apart.

An online attack happens through the real sign-in page. Every guess is sent to the website, which can slow down responses, lock the account after several failures, require a CAPTCHA or flag the activity. An attacker might manage a handful of guesses per account before being blocked. Against online attacks, even a moderately good password survives, as long as it isn't one of the most common ones.

An offline attack happens after a breach, when the attacker has a copy of the site's password database on their own computers. Now there are no lockouts and no rate limits. Specialized hardware with graphics cards can test billions of guesses per second against weakly protected databases. Against offline attacks, only long, unpredictable passwords survive.

You never know in advance whether a site will be breached or how carefully it stored passwords. So the safe assumption is that, someday, someone will attack your password offline. Build passwords for that worst case.

Step 2 of 12Compare

Online vs. offline attacks

AspectOnline attackOffline attack
Where guesses goThe real website sign-inThe attacker's own computers, against a stolen database
Typical speedA few guesses before lockouts or delaysUp to billions of guesses per second for weak storage
What stops itLockouts, rate limits, MFA, avoiding common passwordsLong, unpredictable passwords; strong hashing by the site
When it happensAny timeAfter the site's database is stolen

Step 3 of 12Learn

Hashing and salting, in plain terms

Responsible websites don't store your actual password. They store a hash: the output of a one-way mathematical function. When you sign in, the site hashes what you typed and compares it with the stored hash. The same input always gives the same hash, but you can't run the function backward to get the password.

So how do attackers "crack" hashes? They guess. They hash "password123," compare it with the stolen hashes, and repeat billions of times. When a guess produces a matching hash, they've found the password.

Two site-side defenses slow this down:

  • Salting adds a random value, unique to each user, before hashing. Two people with the same password get different hashes, so attackers can't crack everyone at once or use precomputed tables.
  • Slow hashing algorithms (such as bcrypt, scrypt or Argon2) are deliberately expensive, so each guess takes far longer than with fast general-purpose hashes.

Some sites still store passwords with fast, unsalted hashes, or even in plain text. You can't check how a site does it. Your part of the bargain is a password long and random enough that guessing it is hopeless even if the site did a poor job.

Step 4 of 12Practice · Fill in the blanks

Fill in the blanks

Websites should store a of your password rather than the password itself, and add a random unique to each user so identical passwords don't produce identical results.

Step 5 of 12Learn

The math of guessing

The number of possible passwords depends on two things: the size of the character set (N) and the length (L). The total number of combinations is:

combinations = NL

Lowercase letters only give N = 26. Adding uppercase gives 52, adding digits gives 62, and using all printable keyboard symbols gives about 95.

Length matters far more than character set, because it's the exponent. Compare:

  • 8 characters, all 95 symbols: 958 ≈ 6.6 × 1015 combinations.
  • 12 characters, lowercase only: 2612 ≈ 9.5 × 1016, already about 14 times more.
  • 16 characters, lowercase only: 2616 ≈ 4.4 × 1022.

On average, a brute-force attacker finds the password after trying half the combinations. At 10 billion guesses per second, a random 8-character password using every symbol falls in about four days on average. A random 16-character lowercase password would take on the order of 70,000 years.

One crucial caveat: this math assumes the password is random. Human-chosen passwords aren't. Attackers start with lists of leaked passwords, dictionary words and predictable patterns, which find "Summer2026!" almost instantly despite its length and symbols.

Step 6 of 12Explore

How length changes cracking time

The curve shows the base-10 logarithm of the average seconds needed to brute-force a random password of length x. A value of 9 means about a billion seconds (roughly 32 years). Each step up the vertical axis is ten times longer. This assumes truly random characters; human patterns fall much faster.

-100102030 5101520
Combinations at length L (log10)
21.5
Average years to crack at length L
5,111.71 years
Entropy at length L
71.5 bits

Step 7 of 12Practice · Work it out

How many possible combinations does a 6-digit PIN have (digits 0 to 9 only)?

Step 8 of 12Try the calculator

Brute-force time calculator

Average time for a random password, assuming the attacker must try half of all combinations.

Combinations
6,634,204,312,890,625
Average seconds
331,710 s
Average days
3.8 days
Average years
0.01 years

Step 9 of 12Practice · Choose one

Which change increases the number of possible combinations the most for a random password that is currently 10 lowercase letters?

Step 10 of 12Note

Step 11 of 12Tap to reveal

Inside an attacker's guessing order

  1. 1. Leaked passwords

    Real passwords from past breaches, sorted by popularity. Millions of people chose the same few thousand, so this list alone cracks a large share of any database.

  2. 2. Dictionary words and names

    Words in many languages, names, places, sports teams, bands and pop culture terms, including multiword phrases.

  3. 3. Mangling rules

    Each word with capital letters, symbol swaps like @ for a, years and digits appended, and exclamation marks added. Thousands of variants per word, still fast.

  4. 4. Masks and patterns

    Shapes like one capital, five lowercase letters and two digits, which match how people build passwords to satisfy rules.

  5. 5. Pure brute force

    Every combination of every character, used last because it is slowest. Long random passwords can only be found this way, which is why they survive.

Step 12 of 12Practice · True or false

"Summer2026!" is very hard to crack because it is 11 characters long and uses uppercase, lowercase, digits and a symbol.