How strong is a password? Entropy explained
Password strength is not about how odd a password looks. It is about how many equally likely passwords an attacker must try. That number has a simple formula, and once you can compute it, the case for long random passwords becomes obvious.
Random password generator
The entropy formula
If every character is picked at random from a set of N symbols, a password of length L is one of NL equally likely possibilities. Entropy expresses that count in bits, which is easier to compare:
Each extra bit doubles the number of guesses needed. Character set sizes: lowercase letters give 26, letters in both cases give 52, add digits for 62, and add the 32 printable ASCII symbols for 94.
| Character set | N | Length | Entropy (1 decimal) |
|---|---|---|---|
| Digits only (a PIN) | 10 | 4 | 13.3 bits |
| Lowercase | 26 | 8 | 37.6 bits |
| All printable ASCII | 94 | 8 | 52.4 bits |
| All printable ASCII | 94 | 12 | 78.7 bits |
| Lowercase | 26 | 16 | 75.2 bits |
| All printable ASCII | 94 | 16 | 104.9 bits |
Notice the fifth row: 16 lowercase letters (75.2 bits) are almost as strong as 12 characters of the full keyboard (78.7 bits). Length is the cheaper way to buy strength, and lowercase is far easier to type on a phone.
What the bits mean in time
Example. Suppose an attacker has a stolen, fast-to-check hash and can test 10 billion guesses per second. On average they find the password after searching half the space.
- 52.4 bits: 252.4 ÷ 2 ÷ 1010 ≈ 2.9 × 105 seconds, about 3.4 days.
- 78.7 bits: about 7.8 × 105 years at the same speed.
The guess rate is an assumption for illustration. Slow password hashes such as bcrypt or Argon2 cut it by many orders of magnitude.
Passphrases
A passphrase made of words picked at random from a list works the same way, with N equal to the list size. The Diceware list has 7,776 words (65, one word per five dice rolls). Five words give 5 × log2(7776) ≈ 64.6 bits and six words give about 77.5 bits. The words must be chosen by dice or a random generator, not by you; a phrase you picked from a song has almost no entropy.
Why the formula fails for human-made passwords
The formula assumes every character is random. Summer2024! has 11 characters from a 94-symbol set, which looks like 72 bits, but attackers try dictionary words, capital first letters, years and a trailing ! first. Its real strength is a tiny fraction of that. Replacing a with @ fools nobody either: cracking tools apply those swaps automatically.
A practical checklist
- Use a password manager and let it generate a different random password for every site.
- Aim for at least 70 bits for anything that matters, for example 16 random lowercase letters or 12 random characters from the full set.
- Remember only a few strong passphrases: the manager’s master password and your main email.
- Turn on two-factor sign-in where it is offered. A strong password does not help if it is phished.
Questions
How does this generator pick characters?
It reads random bytes from crypto.getRandomValues and discards bytes that would make some characters more likely than others (rejection sampling). The password is never sent or stored.
Should a password include one of every character type?
Forcing one of each type slightly reduces the possible combinations. Some sites require it, so turn on all sets for those sites; otherwise length matters more.
Is 128 characters overkill?
Past roughly 128 bits of entropy, extra length adds nothing useful, and some sites truncate long passwords. Twenty random characters from the full set already give about 131 bits.