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 bits of entropy forces an attacker to make guesses to try every possibility by brute force. On average the correct password is found after searching half of that space ( guesses).
The Basic Formula
Let be the length of the password and the size of the pool each character is chosen from:
Common pool sizes ():
- Digits only (0-9):
- Lowercase letters (a-z):
- Upper + lowercase (A-Za-z):
- Alphanumeric (A-Za-z0-9):
- Full printable ASCII (letters + digits + 32 symbols):
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:
The total keyspace is therefore:
Attacker Hardware and Crack Time
To estimate crack time you need to know how many guesses per second the attacker can make:
- Offline attack on a fast hash (NTLM / MD5): A single high-end GPU tests on the order of 100 billion () fast hashes per second, and a rig with several GPUs multiplies that.
- 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 () guesses per second.
- Online attack against a login form: Web applications usually rate-limit by IP address. Even without limits, around 100 () requests per second is a realistic ceiling.
Crack Time Table (worst case: full search at guesses per second)
- 40 bits: seconds (instantly broken)
- 55 bits: hours (about 4 days)
- 65 bits: years
- 80 bits: years (impractical to crack)
- 100 bits: 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.