Cryptography & Math•9 min read•

What is Password Entropy and How is it Calculated in Bits?

Information theory, Shannon entropy formula, keyspace cardinality, and mathematical brute-force crack time formulas.

What is Password Entropy in Information Theory?

In cryptography and information security, entropy measures how unpredictable and random a password is from an attacker's point of view. It is expressed in bits.

A password with EE bits of entropy forces an attacker to make 2E2^E guesses to try every possibility by brute force. On average the correct password is found after searching half of that space (2E−12^{E-1} guesses).


The Basic Formula

Let LL be the length of the password and NN the size of the pool each character is chosen from:

E=L×log⁡2(N)E = L \times \log_2(N)

Common pool sizes (NN):

  • Digits only (0-9): N=10  ⟹  log⁡2(10)≈3.322 bits per characterN = 10 \implies \log_2(10) \approx 3.322 \text{ bits per character}
  • Lowercase letters (a-z): N=26  ⟹  log⁡2(26)≈4.700 bits per characterN = 26 \implies \log_2(26) \approx 4.700 \text{ bits per character}
  • Upper + lowercase (A-Za-z): N=52  ⟹  log⁡2(52)≈5.700 bits per characterN = 52 \implies \log_2(52) \approx 5.700 \text{ bits per character}
  • Alphanumeric (A-Za-z0-9): N=62  ⟹  log⁡2(62)≈5.954 bits per characterN = 62 \implies \log_2(62) \approx 5.954 \text{ bits per character}
  • Full printable ASCII (letters + digits + 32 symbols): N=94  ⟹  log⁡2(94)≈6.555 bits per characterN = 94 \implies \log_2(94) \approx 6.555 \text{ bits per character}

This formula only holds when every character is chosen randomly and independently, as a CSPRNG-based generator does. A human-chosen password such as Summer2024! uses the same character types but has far less real entropy because it follows a predictable pattern.

Worked Example

A 12-character password drawn from full ASCII: E=12×log⁡2(94)≈12×6.555=78.66 bitsE = 12 \times \log_2(94) \approx 12 \times 6.555 = 78.66 \text{ bits}

The total keyspace is therefore: 278.66≈4.76×1023 combinations2^{78.66} \approx 4.76 \times 10^{23} \text{ combinations}


Attacker Hardware and Crack Time

To estimate crack time you need to know how many guesses per second the attacker can make:

  1. Offline attack on a fast hash (NTLM / MD5): A single high-end GPU tests on the order of 100 billion (101110^{11}) fast hashes per second, and a rig with several GPUs multiplies that.
  2. Offline attack on a slow key derivation function (Argon2id / bcrypt): Memory-hard algorithms resist GPU parallelism. Depending on the parameters, a server may manage only around 10,000 (10410^4) guesses per second.
  3. Online attack against a login form: Web applications usually rate-limit by IP address. Even without limits, around 100 (10210^2) requests per second is a realistic ceiling.

Crack Time Table (worst case: full search at 101110^{11} guesses per second)

  • 40 bits: 240/1011≈112^{40} / 10^{11} \approx 11 seconds (instantly broken)
  • 55 bits: 255/1011≈1002^{55} / 10^{11} \approx 100 hours (about 4 days)
  • 65 bits: 265/1011≈11.72^{65} / 10^{11} \approx 11.7 years
  • 80 bits: 280/1011≈383,0002^{80} / 10^{11} \approx 383{,}000 years (impractical to crack)
  • 100 bits: 2100/1011≈4002^{100} / 10^{11} \approx 400 billion years (safe on a cosmological scale)

On average an attacker succeeds in half of these times. Each extra bit doubles the work, which is why adding length is the most effective way to increase strength.

Generate Strong Credentials Instantly

Hardware-backed Web Crypto API with zero logging and zero server contact.

Open Password Generator →