How Long Should a Password Be? The Math, Simply Explained

By The UtilCraft team · 4 min read ·

Ask ten websites how long a password should be and you'll get ten answers, usually framed as rules: at least 8 characters, one capital, one symbol. The rules miss the point. What makes a password strong is how hard it is to guess, and that can actually be measured. Once you see the maths, the answer becomes simple.

Strength is measured in bits

Imagine an attacker who knows exactly how your password was made (say, 12 random lowercase letters) but not the password itself. The number of possibilities they'd have to try is 2612, about 95 quadrillion. Security people express that as entropy: the base-2 logarithm of the number of possibilities. Here, log₂(2612) ≈ 56 bits.

For a randomly generated password, the formula is short:

entropy = length × log₂(number of possible characters)
Character setSizeBits per character
Digits only103.3
Lowercase letters264.7
Upper + lowercase525.7
Upper + lower + digits625.95
All printable ASCII946.55

Each extra bit doubles the number of guesses needed. Now compare two ways of strengthening a 12-letter lowercase password: switching it to mixed case adds 12 bits (one per character), while simply making it 16 lowercase letters long adds about 19. Length beats complexity, and it's easier to type.

How fast can attackers guess?

It depends enormously on wherethey're guessing. There are two very different situations.

Online attacksgo through a login form. Rate limits, lockouts and CAPTCHAs keep attackers to perhaps a few guesses per second at most. Even a mediocre password survives this, unless it's on the list of the most common passwords that attackers try first.

Offline attackshappen after a database leak. The attacker has the password hashes and can test guesses on their own hardware, as fast as it goes. With a fast, unsalted hash like MD5, a single modern GPU can test billions of guesses per second. With a deliberately slow algorithm like bcrypt or Argon2, that falls to thousands. You can't control which one a website uses, so plan for the bad case.

Here's roughly how long an exhaustive search takes at 100 billion guesses per second, a well-equipped attacker against a fast hash:

Random passwordEntropyTime to try every possibility
8 chars, full ASCII~52 bitsAbout 17 hours
10 chars, full ASCII~66 bitsAbout 17 years
12 chars, full ASCII~79 bitsAbout 150,000 years
16 chars, full ASCII~105 bitsLonger than the age of the universe, many times over

On average an attacker finds the password halfway through, and hardware keeps getting faster, so leave a wide margin. That's why 8 characters, still the minimum on many sites, is no longer enough for anything that matters, and why 16 random characters is a comfortable default: far beyond any foreseeable attack, and no harder to use when a password manager types it for you.

The catch: this only applies to random passwords

Every number above assumes the password was chosen uniformly at random. Human-chosen passwords aren't. People pick words, names and dates, capitalise the first letter, put the number and the symbol at the end, and swap a for @. Cracking tools know all of this. They start with lists of billions of leaked passwords and apply exactly those substitutions.

So Summer2026!ticks every box on a typical strength meter (upper, lower, digits, symbol, 11 characters) and would fall almost instantly, because it's a word, a year and an exclamation mark, in that order. Its real entropy is closer to 25 bits than the 72 the formula suggests.

What about passphrases?

A passphrase is several random words, like orbit-lantern-cactus-velvet-harbor. The maths is the same, except the "characters" are words. With the EFF's long wordlist of 7,776 words, each word adds about 12.9 bits:

  • 4 words ≈ 52 bits: fine for low-value accounts, weak against offline attacks.
  • 5 words ≈ 65 bits: reasonable.
  • 6 words ≈ 78 bits: strong, and the usual recommendation for a password manager's master password.

The words must be picked randomly, by dice or by software, not chosen by you. "correct horse battery staple" was secure in the famous xkcd comic; today it's on every cracking list.

Practical recommendations

  • Use a password manager and let it generate a unique random password for every site: 16+ characters, all character types if allowed.
  • Memorise only a few things: your password manager's master passphrase (6+ random words) and maybe your device login.
  • Never reuse passwords. Reuse turns one site's breach into access to your other accounts. That risk is bigger than any length question.
  • Turn on two-factor authentication, or better, use passkeys where offered. They make a stolen password far less useful.
  • Change a password when there's a reason, such as a breach or a shared device, not on a schedule. Forced rotation mostly produces predictable patterns like Spring2026! → Summer2026!.

Need one now? Our Password Generatorcreates them with your browser's cryptographic random number generator. Nothing is sent anywhere, and every character type you select is guaranteed to appear. If you're building a login system, the counterpart is hashing: store passwords with Argon2id, scrypt or bcrypt, never with a fast hash like the ones in our Hash Generator, which are meant for checksums.

Tools used in this guide

Keep reading