Key Space Size
Number of possible keys for a b-bit key.
Live Calculator
MembersVariables
Example
128-bit key: K = 2^128 ≈ 3.4×10³⁸
How it works
A binary key of length b has two choices for each bit: 0 or 1. Because these choices are independent, the total number of distinct keys is 2 multiplied by itself b times, which gives 2^b. This is the size of the key space, and it matters because a larger key space makes exhaustive brute-force search much harder.
When to use it
Use this formula when you want to estimate how many different keys, passwords, or secret bit patterns are possible for a given binary length. It is especially useful in cryptography, security auditing, and comparing how resistant different key sizes are to brute-force attacks.
Worked example, step by step
Suppose a system uses a 56-bit key. K = 2^b K = 2^56 K = 72,057,594,037,927,936 So the key space contains about 7.2 × 10^16 possible keys.
Common mistakes to avoid
- Forgetting that each bit has two possible values, not 10 or 256
- Confusing key length in bits with key size in bytes
- Assuming a larger key space always guarantees practical security without considering weak algorithms or implementation flaws
Did You Know?
AES-128 has more possible keys than there are atoms in a million Earths — brute force is hopeless.
Share this formula
More in Cryptography & Security
View allModular Exponentiation
IntermediateCore operation of RSA encryption — raise a message to a power, modulo n.
RSA Decryption
AdvancedRecovers the message using the private exponent d.
Euler's Totient
IntermediateCounts integers below n coprime to it, for n = pq — used to make RSA keys.
Shannon Entropy
AdvancedAverage information content — and the theoretical strength of a random source.
Password Entropy
IntermediateBits of security from password length and character-set size.
Birthday Bound
AdvancedCollisions become likely after about √ of the hash space.