Security

How Strong Is My Password? Entropy, Crack Times, and What Meters Miss

2026-03-30 · 9 min read · Generate a strong password free →

You type a password into a registration form and a coloured strength bar appears: green, amber or red. What does that bar measure? Most password strength meters are broken in ways that matter. They reward patterns that look strong but fall in seconds, and they penalise patterns that resist attack well. This guide explains what password strength means mathematically, how crack time is calculated, why common meters fail, and how to generate and measure passwords that hold up against real attacks.

The numbers behind the bar: entropy is just length × log₂(alphabet size). A random password over the 94 printable-ASCII characters carries ≈6.55 bits per character, so 8 characters is only ~52 bits (crackable in under an hour offline), 16 is ~105 bits, and ToolPry's Password Generator default of 20 characters is ~131 bits. A Diceware passphrase from a 7,776-word list adds ~12.9 bits per word, so its 4-word default is ~52 bits and 5 words ~65 bits. At a generous trillion guesses per second, 105 bits still works out to roughly 10¹¹ years. The recommendations here follow NIST SP 800-63B; for storing the resulting passwords safely, the OWASP Password Storage Cheat Sheet is the standard reference.

What Password Strength Measures: Entropy

Password strength comes down to entropy, a mathematical measure of unpredictability expressed in bits. Entropy determines how many guesses an attacker needs, on average, to crack a password by brute force. Each extra bit doubles the number of guesses. Because the growth is exponential, adding a few characters of length does far more than adding a special character to a short password.

The entropy formula: entropy = log₂(character_set_size) × length. Take a 12-character password drawn from all 94 printable ASCII characters: it yields log₂(94) × 12 ≈ 78 bits of entropy. A 20-character password from the same character set yields ≈ 131 bits. At 131 bits, even a hypothetical computer capable of testing one trillion passwords per second would require more time than the current age of the universe to exhaust all possibilities. At 78 bits, the same computer would take about 12 million years. That is still out of reach for brute force alone, but real attacks are smarter than pure brute force.

One caveat matters a lot: the formula assumes the password was generated at random. It breaks down for dictionary words, predictable patterns, and any password a person built on purpose. A human-chosen password is not random. It is shaped by what that person finds memorable, so its effective entropy is far lower than the formula suggests.

Why Most Password Strength Meters Give Wrong Answers

The standard strength meter algorithm awards points for: having uppercase letters, having lowercase letters, having digits, having symbols, and being longer than some minimum. This produces results that are wrong in both directions. P@ssw0rd1! scores "Strong" or even "Very Strong" on most popular meters. It satisfies every complexity rule. It also appears verbatim in every major breach database ever leaked publicly, and any modern cracking tool breaks it in under a second. Meanwhile correct-horse-battery-staple, made famous by an XKCD comic, scores "Weak" or "Moderate" on many meters even though its length gives it high entropy.

Complexity rules fail because modern cracking tools do not try every possible character combination. They start from wordlists of millions of known passwords taken from data breaches and apply rule-based transformations. The rules make substitutions (a to @, o to 0, s to $) and add common patterns (an ! at the end, a trailing 123, a capitalised first letter). P@ssw0rd1! is caught by exactly these rules and cracked in milliseconds, even though it meets every complexity requirement. Looking random is not the same as being random.

The only widely used meter that measures real crack resistance is zxcvbn, the open-source library developed by Dropbox. It matches input against real breach databases, detects dictionary words and common substitutions, and estimates how many guesses a determined attacker would need, including rule-based attacks and not only brute force. Only this kind of measurement predicts real-world security.

Crack Time by Entropy Level

The table shows estimated crack times at 10 billion guesses per second, a realistic offline rate for a dedicated cracking rig against a fast hash like MD5. For passwords hashed with bcrypt or Argon2 (as they should be), the rate drops to thousands or millions of guesses per second, which adds years to each row.

Entropy (bits)Crack time at 10B/secRatingTypical example
< 28Instant (under a second)Terriblepassword, 1234, qwerty, iloveyou
28 – 35Minutes to hoursWeakmonkey2026, summer1, hello!
36 – 59Days to decadesModerateRandom 8-char, P@ssw0rd-variants
60 – 95Centuries to millenniaStrong14+ char random, 4-word passphrase
96 – 127Millions of yearsVery strong18+ char random, 5-word passphrase
> 128Practically impossibleMaximum20+ char random, 6-word passphrase

Calculating Entropy in Python

import math

def password_entropy(password: str) -> float:
    """Calculate theoretical entropy in bits based on character set size.
    NOTE: Accurate only for randomly generated passwords, not dictionary words."""
    charset_size = 0
    if any(c.islower() for c in password): charset_size += 26   # a-z
    if any(c.isupper() for c in password): charset_size += 26   # A-Z
    if any(c.isdigit() for c in password): charset_size += 10   # 0-9
    if any(not c.isalnum() for c in password): charset_size += 32  # symbols
    if charset_size == 0: return 0
    return round(math.log2(charset_size) * len(password), 1)

def crack_time_estimate(entropy: float) -> str:
    guesses_per_sec = 10_000_000_000  # 10 billion — fast offline attack
    total_guesses = 2 ** entropy
    seconds = total_guesses / (2 * guesses_per_sec)  # average is half worst-case
    if seconds < 1: return "Instant"
    if seconds < 60: return f"{int(seconds)} seconds"
    if seconds < 3600: return f"{int(seconds/60)} minutes"
    if seconds < 86400: return f"{int(seconds/3600)} hours"
    if seconds < 31536000: return f"{int(seconds/86400)} days"
    if seconds < 3.15e10: return f"{int(seconds/31536000)} years"
    return "Centuries or longer"

def strength_label(entropy: float) -> str:
    if entropy < 28: return "Terrible"
    if entropy < 36: return "Weak"
    if entropy < 60: return "Moderate"
    if entropy < 96: return "Strong"
    if entropy < 128: return "Very Strong"
    return "Maximum"

# Demo
passwords = [
    "password",            # 38 bits by formula — but in every dictionary
    "P@ssw0rd1!",          # 55 bits by formula — but known leet-speak pattern
    "kX9#mL2@vQ4$",        # 85 bits — genuinely random 13 chars
    "correct-horse-battery-staple",  # 77 bits — 4-word passphrase
    "7hK!mP3xNq8@wR2vLz",  # 124 bits — 18-char random
]

for pwd in passwords:
    e = password_entropy(pwd)
    print(f"{pwd!r[:30]}")
    print(f"  Entropy: {e} bits | Strength: {strength_label(e)} | Crack time: {crack_time_estimate(e)}")
    print()

Tested: Node.js 22.x, Python 3.12.4, Chrome 125. Output may vary on older runtimes.

Important limitation: The entropy formula assumes each character is chosen at random. Dictionary words and leet-speak substitutions score much higher than their real resistance to attack. P@ssw0rd1! scores 55 bits by formula but is cracked instantly because it matches known attack patterns. Use zxcvbn for real measurement, not this formula alone.

Two Strategies for Strong Passwords

Strategy 1: Cryptographically random strings for a password manager

For every password stored in a manager (which should be every password except your master password), use a randomly generated string of 16 to 20 characters with letters, digits and symbols. Randomness is the property that counts, not length alone or character variety alone. A 20-character string where every character is chosen uniformly at random from a 94-character alphabet has 131 bits of entropy and no pattern that rule-based cracking tools can exploit.

ToolPry's Password Generator uses crypto.getRandomValues(), the browser's cryptographically secure random number generator and the same API browsers use for TLS key generation. The password is generated entirely in your browser and never transmitted. To confirm this, read the page source or watch the browser's network tab: no requests are made when you click Generate.

Strategy 2: Diceware passphrases for passwords you must memorise

For passwords you type from memory (your password manager master password, your laptop login, your email account), Diceware passphrases are both memorable and secure. Diceware picks words at random from a numbered wordlist, using physical dice or a cryptographically secure random number generator. Each word from a 7,776-word list adds exactly log₂(7,776) ≈ 12.9 bits of entropy.

Four randomly selected words: ≈ 52 bits. Five words: ≈ 64 bits. Six words: ≈ 77 bits. Six words match a 13-character fully random password in entropy, and are much easier to memorise and type. The security comes entirely from random selection. If you choose words because they feel memorable or meaningful, you are not using Diceware, and the entropy is much lower.

import secrets

# Load the real EFF wordlist for production use
# https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt
# The list has 7,776 words (6^5 — one per five dice rolls)

# Simplified example with a small sample list
WORDS = [
    "apple", "bridge", "canopy", "dancer", "eagle", "fable", "garlic", "harbor",
    "island", "jungle", "kitten", "lemon", "mango", "novel", "ocean", "pepper",
    "quartz", "river", "sunset", "tiger", "umbra", "valley", "walnut", "xenon",
    "yellow", "zipper"
]

def generate_passphrase(word_count: int = 6, separator: str = "-") -> str:
    """Generate a random passphrase. Uses secrets module for cryptographic randomness."""
    words = [secrets.choice(WORDS) for _ in range(word_count)]
    return separator.join(words)

for length in [4, 5, 6]:
    phrase = generate_passphrase(length)
    entropy = length * math.log2(7776)  # using full wordlist size
    print(f"{length} words: {phrase}")
    print(f"  Entropy: {entropy:.1f} bits ({strength_label(entropy)})")
    print()

Tested: Node.js 22.x, Python 3.12.4, Chrome 125. Output may vary on older runtimes.

Checking If Your Password Has Been Breached

Format and length tell you how hard a password is to crack by brute force. They say nothing about whether the password already sits in the breach databases attackers try first. HaveIBeenPwned (HIBP) maintains a database of over 900 million breached passwords collected from publicly released breach dumps. Its k-anonymity API lets you check any password against that database without transmitting the password itself.

import hashlib
import requests

def count_breach_appearances(password: str) -> int:
    """
    Returns how many times this password appears in known breach databases.
    Returns 0 if not found.
    Uses k-anonymity: only the first 5 chars of the SHA-1 hash are sent.
    The actual password is never transmitted.
    """
    sha1_hash = hashlib.sha1(password.encode('utf-8')).hexdigest().upper()
    prefix = sha1_hash[:5]
    suffix = sha1_hash[5:]

    response = requests.get(
        f'https://api.pwnedpasswords.com/range/{prefix}',
        headers={'Add-Padding': 'true'},  # prevents traffic analysis
        timeout=10
    )
    response.raise_for_status()

    for line in response.text.splitlines():
        hash_suffix, count = line.split(':')
        if hash_suffix == suffix:
            return int(count)
    return 0

# Check a password
password = "hunter2"
count = count_breach_appearances(password)
if count > 0:
    print(f'EXPOSED: This password appears in {count:,} known breaches.')
    print('Change it immediately on every site where you use it.')
else:
    print('Not found in HIBP breach database.')
    print('(This does not guarantee it is safe — only that it is not in this list.)')

Tested: Node.js 22.x, Python 3.12.4, Chrome 125. Output may vary on older runtimes.

Building a Real-Time Strength Indicator With zxcvbn

zxcvbn is the state-of-the-art JavaScript library for estimating password strength. Unlike formula-based meters, it judges how well a password resists cracking by checking it against known patterns, breach wordlists, keyboard patterns and dictionary attacks. It returns a single score from 0 (terrible) to 4 (very strong), plus an estimated crack time and specific suggestions for improvement.

// npm install zxcvbn
// CDN: https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js
import zxcvbn from 'zxcvbn';

const SCORE_CONFIG = [
  { label: 'Terrible',   colour: '#ef4444', width: '10%'  },
  { label: 'Weak',       colour: '#f97316', width: '25%'  },
  { label: 'Fair',       colour: '#eab308', width: '50%'  },
  { label: 'Good',       colour: '#22c55e', width: '75%'  },
  { label: 'Very Strong',colour: '#22d3ee', width: '100%' },
];

function evaluatePassword(password) {
  if (!password) return null;
  const result = zxcvbn(password);
  const config = SCORE_CONFIG[result.score];

  return {
    score: result.score,
    label: config.label,
    colour: config.colour,
    barWidth: config.width,
    crackTime: result.crack_times_display.offline_fast_hashing_1e10_per_second,
    suggestions: result.feedback.suggestions,
    warning: result.feedback.warning,
  };
}

// Example usage in a React component
function PasswordField() {
  const [password, setPassword] = React.useState('');
  const strength = password ? evaluatePassword(password) : null;

  return (
    <div>
      <input
        type="password"
        value={password}
        onChange={e => setPassword(e.target.value)}
        placeholder="Enter password"
      />
      {strength && (
        <div>
          <div style={{
            height: 4, background: '#1a1a1e', borderRadius: 2, marginTop: 8
          }}>
            <div style={{
              width: strength.barWidth,
              height: '100%',
              background: strength.colour,
              borderRadius: 2,
              transition: 'all 0.3s ease',
            }} />
          </div>
          <p style={{ fontSize: 13, color: strength.colour, marginTop: 4 }}>
            {strength.label} — crack time: {strength.crackTime}
          </p>
          {strength.warning && (
            <p style={{ fontSize: 12, color: '#f87171' }}>{strength.warning}</p>
          )}
          {strength.suggestions.map((s, i) => (
            <p key={i} style={{ fontSize: 12, color: '#a1a1aa' }}>• {s}</p>
          ))}
        </div>
      )}
    </div>
  );
}

Tested: Node.js 22.x, Python 3.12.4, Chrome 125. Output may vary on older runtimes.

Password Strength Requirements for Developers: What to Enforce

On a registration form, the rules you impose shape the passwords your users create. The most effective approach, backed by current NIST SP 800-63B guidance (updated 2024), is to enforce minimum length and breach checking and nothing else. Do not require uppercase, lowercase, digits and symbols, because those rules produce P@ssw0rd1! patterns. Do not require periodic rotation either: it produces Password1, Password2, Password3 sequences. Instead, enforce a minimum of 12 characters, check the password against the HIBP breach database, optionally run zxcvbn and reject scores of 0 or 1, and show real-time feedback that steers users to better choices without blocking them needlessly.

// Server-side password validation following NIST SP 800-63B guidance
const axios = require('axios');
const crypto = require('crypto');

async function validatePassword(password) {
  const errors = [];

  // Rule 1: Minimum length (NIST recommends at least 8, we enforce 12)
  if (password.length < 12) {
    errors.push('Password must be at least 12 characters');
  }

  // Rule 2: Maximum length (prevent DoS via hashing extremely long inputs)
  if (password.length > 128) {
    errors.push('Password must be 128 characters or fewer');
  }

  // Rule 3: Check against breach database
  if (password.length >= 12) {
    const sha1 = crypto.createHash('sha1').update(password).digest('hex').toUpperCase();
    const prefix = sha1.slice(0, 5);
    const suffix = sha1.slice(5);
    try {
      const resp = await axios.get(`https://api.pwnedpasswords.com/range/${prefix}`);
      const found = resp.data.split('\r\n').some(line => line.startsWith(suffix));
      if (found) {
        errors.push('This password has appeared in known data breaches. Please choose a different password.');
      }
    } catch (e) {
      // If HIBP is unreachable, do not block registration — just skip this check
      console.warn('HIBP check failed:', e.message);
    }
  }

  return { valid: errors.length === 0, errors };
}

Tested: Node.js 22.x, Python 3.12.4, Chrome 125. Output may vary on older runtimes.

Common Myths About Password Strength

Several common beliefs about password strength are wrong. Knowing why helps with both your own passwords and the policies you set for users.

Myth: Special characters make a password much stronger. A special character from a set of 32 symbols adds log₂(32) = 5 bits of entropy to the character pool, about the same as one more letter. Adding two random characters adds more entropy than changing a letter to a symbol. Special characters help slightly, but they are not a substitute for length.

Myth: A random-looking password with mixed case and symbols is hard to crack. Only if it is random. A human-chosen password that merely looks random, for example by swapping letters for similar-looking symbols, follows patterns that cracking tools target. Looking random and being random are different things. Use a password generator with a verified cryptographically random source, not your own sense of what looks random.

Myth: Longer passwords are always better, regardless of randomness. A 20-character password made entirely of dictionary words chosen for memorability has far lower effective entropy than a 16-character random string, because humans choose words non-randomly. Length helps, but randomness is the prerequisite. A long password constructed from related words is vulnerable to wordlist attacks even if its character count is high.

Myth: Password managers are risky because one breach exposes everything. The risk of a password manager breach is far smaller than the risk of password reuse across multiple sites. When a site is breached and passwords leak, attackers immediately try the same credentials on major email providers, banks and social media. This is called credential stuffing. A password manager with a strong master password and one unique generated password per site means a breach of any one site exposes nothing about any other. On balance, the risk clearly favours using a manager.

Password Entropy FAQ

What minimum password length should I require for my application?

NIST SP 800-63B (2024 revision) recommends a minimum of 8 characters, but practical guidance for new applications is 12 characters as the minimum. The key reasoning: at 12 characters, even a password using only lowercase letters has 56 bits of entropy — into the Strong range. At 8 characters, a lowercase-only password has 37 bits — just barely into the Moderate range and potentially crackable given enough time and computational resources. For high-security contexts like financial or healthcare applications, consider requiring 16 characters minimum.

Should I use a passphrase or a random character string?

For passwords stored in a manager, use a random character string of 16 to 20 characters. For passwords you must memorise and type regularly, use a 5 to 6 word Diceware passphrase. At equivalent entropy, both are equally resistant to brute force. The difference is entirely usability: a 6-word passphrase like ocean-tiger-bridge-fancy-queen-apple is far easier to type accurately from memory than a 13-character random string. Choose based on whether you will store it or memorise it.

How often should passwords be changed?

Only when there is specific reason to believe they have been compromised — a breach notification from a service, suspicious account activity, or confirmed credential exposure. NIST explicitly deprecated mandatory periodic rotation in 2017 and reinforced this in its 2024 update, having found that forced rotation causes users to make small predictable changes that provide no real security benefit. A strong unique password that never changes is more secure than a weaker password changed every 90 days.

Count Bits, Not Bar Colours

Ignore the colour of the strength bar and count bits instead. Generate passwords rather than inventing them: the ToolPry Password Generator defaults to 20 random characters (~131 bits) or a multi-word passphrase, both far past the point where offline cracking is feasible. If a human must memorise it, lengthen the passphrase; if a machine stores it, use the random string.