Guessing, but really, really fast
A brute-force attack is when someone, or a program, tries lots of possible passwords or codes, one after another, until one works. There is no clever trick. It is just speed and patience.
Think of a combination lock with 3 wheels. Each wheel has 10 digits, so there are 10 × 10 × 10 = 1,000 settings. You could try them all in under an hour. A computer can try them in less than a second.
That is why defenders do two things. They make the number of possible answers huge, and they make guessing slow. This page shows you both ideas with toy models you can play with.
Two kinds of guessing
- Pure brute force: try every combination in order, like 000, 001, 002, and so on.
- Dictionary attack: try a list of likely passwords first, such as common words, names, and simple patterns. It is called a dictionary attack because the list often starts as a list of words. People pick predictable passwords, so this shortcut works well against them.
Ethics first. Trying to guess into an account or device that is not yours is illegal in many places, even if you are "just curious." Everything on this page is a harmless toy model. It never touches a real account, and it never asks for a real password. Learn the defense side, then use it. If you like this, see What Is Ethical Hacking?
The search space: how many guesses are there?
The search space is the number of possible passwords. To find it, multiply. If a password has 4 spots and each spot can be one of 26 letters, the space is 26 × 26 × 26 × 26. That is called exponential growth: every new spot multiplies the total, it does not just add to it.
Slide the length and pick what characters are allowed. Watch the number. Then see how long a toy attacker would need.
These speeds are made-up toy numbers so you can compare. Real guess speeds vary hugely depending on the attacker and how a site stores passwords.
On average, an attacker finds the answer about halfway through the list, so "average" is half of the worst case.
Try this: set the characters to digits and the length to 4. Then go to 8. You added only 4 characters, but the space grew by 10,000 times. Now compare that with switching from digits to symbols at length 4.
Crack a toy lock (and then lock it down)
Here is a toy lock. You make up a PIN, and a pretend attacker counts upward from the lowest code until the lock opens. Run it twice: once with no limit on guesses, and once with a lockout. A lockout means that after 5 wrong tries, the lock freezes for a while.
Pick a PIN, choose a rule, and press start.
Toy model: the attacker simply counts up in order, and the clock is pretend. Real phones and sites use longer waits that grow with each failure, and some can erase data after too many tries.
What did you just see?
With no limit, even the last 4-digit PIN (9999) falls in about 17 pretend minutes. With a 5-try lockout, the same PIN would take over 40 pretend days. The code did not get longer. The attacker just was not allowed to guess fast. That is the power of limiting guesses.
People are also not random. Many pick 1234, 0000, or a birthday, so a smart attacker tries those first. That is the dictionary idea again, which you will meet in section 5.
The defense switchboard
Real accounts use more than one layer. Flip the switches below to see how each layer changes what a toy attacker can do against a login page. Defenders use these three ideas:
- Rate limiting slows down how many guesses are allowed in a given time.
- Account lockout freezes the account, or adds a delay, after too many wrong tries.
- Two-factor authentication (2FA) asks for a second proof, like a code from your phone, so a correct password alone is not enough.
Toy attacker: 1,000 guesses per second at a login page with no protection. If both a rate limit and a lockout are on, the stricter one wins. Real attackers may also spread guesses over many accounts, which is why sites watch for that too.
The bars use a log scale: each step to the left is about ten times fewer guesses. The verdict is a toy scale: under a day is fast, under a year is risky, a year or more holds up for this attack.
One catch: these limits only work when the attacker has to ask the login page for each guess. If a company's whole password list is stolen, the attacker can guess on their own computer with no limits at all. Sites fight that by storing passwords in a scrambled form that is slow to check. See What Is Password Hashing?
Dictionary attack vs random passwords
Brute force tries everything. A dictionary attack tries the likely things first. People like words, names, and small tweaks, such as a capital letter on the front and "123" on the back. So a short list of likely guesses can beat a huge search space.
Pick one of these four made-up passwords. A tiny pretend attacker has a list of just 25 words and 7 common tweaks, so only 175 guesses. Then see how long plain brute force would take instead. You cannot type your own password here, on purpose.
Smart-list attack
Tries the 25-word list with 7 tweaks each (175 guesses in all).
Brute force on its shape
Tries every password of the same length and character type.
Real attacker lists hold millions or billions of entries and use many more tweaks. They are still tiny next to the space of truly random passwords. Brute-force times here use a toy speed of 1 billion guesses per second.
The lesson: the attacker's shortcut only works on passwords a human would think of. A password chosen by a random generator has no pattern to exploit, so the shortcut gives the attacker nothing.
Why long passphrases win
A passphrase is a password made of several random words, like "maple orbit lunar quilt". Words are easy for you to remember, but the length makes the search space enormous. Drag the slider to add random words and watch the bar grow.
"Random" matters. The words must be picked by dice or a password generator. A line from a song or a phrase you made up is not random, and attackers try those.
Each word is picked at random from a list of 7,776 words (the size of a common dice-based word list), so each word multiplies the space by 7,776. Bars use a log scale. The speed is a toy number for an attacker who has stolen scrambled passwords and can guess offline.
How to use this in real life
- Go long. Length beats cleverness. Replacing letters with symbols (like "a" to "@") adds little because attackers try those tweaks.
- Make it random. Use a generator or dice for the words. Do not use quotes, lyrics, names, or birthdays.
- Use a different one everywhere. If one site leaks your password, attackers try it on your other accounts. A password manager remembers them for you, and you only need one strong passphrase for the manager itself.
- Turn on 2FA. Even a guessed password then fails. A passkey goes a step further because there is no password to guess.
Want to see a longer discussion of strength? Try How Strong Is Your Password? and the Safe Password Generator.
Words to know
- Brute-force attack
- Trying many possible passwords or codes, one after another, until one works.
- Dictionary attack
- Trying a list of likely passwords first, like common words and simple tweaks.
- Search space
- The total number of possible answers an attacker might have to try.
- Exponential growth
- Growth by multiplying again and again, so numbers get huge very fast.
- Character set
- The kinds of characters allowed, such as digits only or letters, digits and symbols.
- Rate limiting
- Allowing only a few guesses in a given time.
- Account lockout
- Freezing a login, or adding a wait, after too many wrong tries.
- Two-factor authentication (2FA)
- Needing a second proof, like a phone code, in addition to your password.
- Passphrase
- A long password made of several random words.
- Hashing
- Storing a scrambled version of a password so the real one is not saved. Good hashing is slow on purpose.
Think it through
One more letter
A password uses only lowercase letters and is 8 characters long. You make it 9 characters long. About how many times bigger is the search space now? Is that more or less than if you had changed it to use both upper and lowercase letters at the same length of 8?
One more lowercase letter makes the space 26 times bigger. Switching 8 characters from 26 options to 52 options makes it 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 = 256 times bigger. So at this size, changing the character set helps more. But each extra character keeps multiplying, so adding length is the easiest habit to keep up, and it scales much further.
Quick answers
What is a brute-force attack?
A brute-force attack is when someone (or a program) tries many possible passwords or codes, one after another, until one works. It does not use clever tricks. It just uses speed and patience. Limits on how many guesses are allowed, and long random passwords, are the main defenses.
What is the difference between a brute-force attack and a dictionary attack?
A pure brute-force attack tries every possible combination in order. A dictionary attack tries a list of likely passwords first, such as common words, names, and simple patterns like a capital letter plus 123. Dictionary attacks are faster against passwords people choose themselves, because people pick predictable things.
Why does a longer password help so much?
Each extra character multiplies the number of possible passwords instead of just adding to it. With 26 lowercase letters, one more letter makes the search 26 times bigger. That kind of growth is called exponential, and it quickly makes guessing take far too long.
Do lockouts and two-factor authentication really stop brute-force attacks?
They make them far harder. Rate limits and lockouts cut the number of guesses an attacker can make on a login page from thousands per second to a few per hour. Two-factor authentication means even a correct password is not enough without the second code. They work best together with a long, unique password.
Quick quiz
1. A lock has 4 wheels with the digits 0 to 9. How many different settings are there?
2. Why does a lockout after 5 wrong tries slow a brute-force attack so much?
3. Which is the strongest choice against both brute-force and dictionary attacks?
Keep learning and stay secure
You now know why short codes fall fast, how lockouts and 2FA slow attackers down, and why long random passphrases win. Next, learn how a second factor works, or see how sites keep passwords safe even if they leak.
Related: Password Strength and The CIA Triad