Encryption Key Brute Force Time Calculator

A symmetric key of k bits has 2k possible values, and an exhaustive search finds the right one after half of them on average. This calculator turns a key length and an attack rate into the numbers that matter: the size of the keyspace, the expected and worst-case search time, how that compares with the age of the universe, the electricity the search would consume, and the effective strength left if a large quantum computer running Grover's algorithm is assumed. It models brute force only — the search space a well-chosen random key presents — not a flaw in the cipher or a guessable password.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Key lengthThe number of bits of a uniformly random key: 128 or 256 for AES, 112 for three-key Triple DES, 56 for DES.128 bits
Attack rate per deviceTrial decryptions one machine performs per second. A high-end GPU does on the order of 10 G to 100 G simple hash trials per second; a purpose-built ASIC does far more.1 keys/s
Number of devicesHow many machines search in parallel. Brute force parallelises perfectly, so total rate is simply rate per device times this number.1000 devices
Model a Grover-style quantum searchTick to halve the effective key length, which is the standard first-order model of Grover's algorithm against a symmetric cipher.No
Energy per trialElectrical energy consumed by one trial decryption. Divide a device's power draw in watts by its trial rate to get this figure.10 J
Electricity priceIndustrial rate the attacker pays. Used only to convert the energy total into money.0.12 $/kWh

It returns

  • Expected search time — Time to try half the effective keyspace at the total attack rate, in mean Gregorian years of 31,556,952 seconds.
  • Total keyspace (2^k) — Every value the key can take. Independent of the attack model.
  • Expected number of trials — Half the effective keyspace — the average position of the correct key in a random search order.
  • Worst-case search time
  • Expected time ÷ age of the universe — Against 13.797 billion years, the Planck 2018 figure for the age of the universe.
  • Energy for the expected search
  • Electricity cost of the expected search
  • Effective security strength — Equals the key length classically, and half of it under the Grover model.

The formula

t=2k1R
TGroverN=2k/2
Emin=kBTln2

In plain text: Expected trials = 2^(k−1); time = 2^(k−1) / R; Grover: effective k′ = k/2

  • kKey length, or effective strength under a quantum model (bits)
  • RTotal trial rate — rate per device × number of devices (keys/s)
  • tExpected time to find the key (s)
  • NKeyspace, 2^k (keys)
  • EEnergy consumed by one trial (J)

The factor of 2 in 2^(k−1) is the average, not a bound: a random search order finds the key after half the space on average, and the worst case is the full 2^k. Doubling the attacker's hardware removes exactly one bit from the effective key length.

Updated Category Security, Cryptography & Risk Verified against published test cases Reading time 14 min

What brute force actually means for a symmetric key

Brute force is the attack that always works given enough time: try every possible key until one decrypts the ciphertext into something meaningful. Its cost is therefore a property of the key length alone, and it sets the ceiling on how strong a cipher can be. A cipher is considered broken when someone finds an attack materially cheaper than this ceiling.

A k-bit key drawn uniformly at random has 2k possible values. Searching in a random order, you expect to find it halfway through, after 2k−1 trials. That single factor of two is worth noticing because it is the only place brute-force arithmetic gets easier: everything else about the problem grows by a factor of two for every bit you add.

The exponential growth is the whole story. A 64-bit key has 4.3 billion times the keyspace of a 32-bit key. A 128-bit key has 1.8×1019 times the keyspace of a 64-bit one. Attackers respond by parallelising, but parallelism is linear and the defence is exponential: doubling the attacker's hardware removes exactly one bit from the effective key length. Going from one machine to a million removes about twenty bits. Against a 128-bit key, that leaves 108 bits, which is not progress in any practical sense.

Two caveats bound what this calculator can tell you. First, it assumes the key is uniformly random. A key derived from a human-chosen password has far less entropy than its bit length suggests — quantify that with the password entropy calculator instead. Second, it assumes the cipher has no shortcut. Brute force is the ceiling; cryptanalysis, side channels, implementation bugs and key-management failures are the floor, and every real-world break in living memory has come from one of those rather than from exhausting a keyspace.

The arithmetic, and where each term comes from

Keyspace. N = 2k. Nothing subtle here, but the numbers become hard to hold: 256 is 7.2×1016, roughly the number of grains in a cubic kilometre of fine sand; 2128 is 3.4×1038, which is more than the estimated number of atoms in the Earth's oceans by a wide margin. The calculator reports these in scientific notation for that reason.

Expected trials. 2k−1. If the key is drawn uniformly and you search in an order uncorrelated with it, the position of the correct key is uniform on 1…N, so its expected value is (N+1)/2, which for large N is N/2.

Time. Divide by the total rate. Total rate is the rate one device achieves multiplied by the number of devices, because brute force is embarrassingly parallel — each machine takes a disjoint slice of the keyspace and there is no communication between them. That property is why key-search estimates scale so cleanly and why an attacker's budget translates directly into bits.

Energy. Multiply trials by the energy one trial consumes. This is often the more persuasive number, because energy has a hard physical floor while time does not obviously have one. The Landauer limit says that erasing one bit of information at temperature T must dissipate at least kB·T·ln 2 joules. At 300 K that is 1.380649×10−23 × 0.693147 × 300 = 2.871×10−21 J. Even at that impossible efficiency, and even pretending a trial decryption costs a single bit erasure, searching half of a 128-bit keyspace needs 1.7014×1038 × 2.871×10−21 = 4.884×1017 J, which is 1.357×1011 kWh, or about 136 TWh. A real AES trial costs thousands of bit operations, so multiply that figure by three or four orders of magnitude to get anywhere near a physical machine.

The quantum adjustment. Grover's algorithm finds a marked item in an unstructured space of N candidates in about √N queries rather than N. Applied to key search, √(2k) = 2k/2, so the effective strength halves: AES-128 offers about 64 bits against an ideal quantum adversary, and AES-256 offers about 128. This is the reasoning behind the standard advice to double symmetric key lengths, and it is why AES-256 is treated as the quantum-resistant choice while AES-128 is not. The model is deliberately generous to the attacker — it ignores the enormous constant factors, the serial depth of the Grover iteration, and the error-correction overhead a real machine would carry.

Worked example: AES-128 against a very large attacker

Suppose an attacker fields one thousand machines, each performing 1012 AES trial decryptions per second — a rate no publicly known hardware reaches for full AES, chosen to be generous.

  1. Keyspace. 2128 = 3.4028×1038 keys.
  2. Expected trials. 2127 = 1.7014×1038.
  3. Total rate. 1012 × 1,000 = 1015 keys per second.
  4. Expected seconds. 1.7014×1038 ÷ 1015 = 1.7014×1023 s.
  5. Expected years. 1.7014×1023 ÷ 31,556,952 = 5.3916×1015 years.
  6. Against the age of the universe. 5.3916×1015 ÷ 1.3797×1010 = 390,780 times over.
  7. Energy, at 10 nJ per trial. 1.7014×1038 × 10−8 = 1.7014×1030 J, which is 4.726×1023 kWh.
  8. Electricity, at $0.12/kWh. 5.67×1022 dollars.

Now apply the Grover model to the same key. Effective strength drops to 64 bits, expected trials to 263 = 9.2234×1018, and at 1015 keys per second that is 9,223 seconds — under three hours. The gap between step 5 and this line is the entire argument for AES-256. Repeat the calculation at 256 bits and the Grover-adjusted figure returns to 2127 trials, exactly the classical AES-128 workload, which is the sense in which doubling the key restores the original margin.

How to read the result

Read the exponent, not the mantissa. Whether the answer is 5×1018 years or 2×1019 years makes no difference to any decision; whether it is 106 or 1018 makes every difference. That is also why sensitivity analysis is pointless above about 100 bits: multiply the attacker's budget by a million and you have removed twenty bits, which moves 1018 years to 1012 years. The conclusion is unchanged.

Compare against a security-strength target rather than against a wall-clock intuition. NIST SP 800-57 Part 1 Rev. 5 organises algorithms by security strength in bits — 112, 128, 192 and 256 — and treats 112-bit strength as acceptable only through 2030, with 128 bits and above as the durable choice. Anything below 112 bits is disallowed for applying new cryptographic protection. Those are the numbers to design against; they already fold in decades of margin for hardware improvement.

Distinguish key length from security strength. They are equal for a well-designed symmetric cipher and they are not equal for asymmetric ones: a 3072-bit RSA modulus provides about 128 bits of security strength, because factoring is far cheaper than exhaustive search over the modulus. This calculator models symmetric key search only. If you enter an RSA or Diffie–Hellman modulus size here, the answer will be enormously optimistic.

Finally, notice what the result implies about where to spend effort. If your keyspace figure is 1038 and your key is generated by a library seeded from the operating system's cryptographic random source, brute force is not your problem. Your problems are key storage, key rotation, an implementation that leaks timing, a backup that contains plaintext, and an administrator who can be phished. Rank those with the CVSS base score calculator and price them with the annualised loss expectancy calculator.

Expected exhaustive-search time by key length

Expected trials are 2k−1; time assumes a total rate of 1012 keys per second and a mean Gregorian year of 31,556,952 seconds. Multiply the rate by 10n to divide every time by 10n.
Key bitsKeyspace 2kExpected trials 2k−1Expected time at 1012 keys/s
401.0995×10125.4976×10110.55 seconds
56 (DES)7.2058×10163.6029×101610.0 hours
641.8447×10199.2234×1018106.8 days
801.2089×10246.0446×10231.9154×104 years
112 (3-key 3DES)5.1923×10332.5961×10338.2268×1013 years
128 (AES-128)3.4028×10381.7014×10385.3916×1018 years
192 (AES-192)6.2771×10573.1386×10579.9457×1037 years
256 (AES-256)1.1579×10775.7896×10761.8346×1057 years

For scale, the universe is about 1.38×10¹⁰ years old, so even the 112-bit row exceeds it by a factor of roughly six thousand at this rate. The 40-bit row is there because it was the export-grade limit imposed by United States regulation until the late 1990s, and it explains why those ciphers were retired.

This models a random key, not a password

The moment a key is derived from something a person chose, the keyspace stops being 2k. An AES-256 key derived from a twelve-character password has at most the entropy of that password — typically well under 80 bits, and often under 40 — regardless of the 256-bit key the derivation function produces. Attackers do not search the key space; they search the password space and derive.

That is what key derivation functions such as PBKDF2, scrypt and Argon2 address, and they address it by making each guess expensive rather than by adding entropy. A work factor that costs 100 ms per derivation reduces an attacker's effective rate from billions per second to tens per second per core, which is worth roughly 25 bits — valuable, but no substitute for a high-entropy secret. Estimate the real search space with the password entropy calculator and the resulting attack time with the password crack time calculator.

Assumptions and limits of this model

  • The key is uniformly random. Any bias, any pattern, any reused nonce or predictable seed reduces the real search space, sometimes by an enormous factor.
  • The cipher has no shortcut. Published cryptanalysis of AES shaves a couple of bits off exhaustive search in impractical settings; a badly designed cipher can be worse by dozens of bits. The number here is the ceiling, not a guarantee.
  • Trials are independent and verifiable. The attacker must be able to recognise the right key, which needs known plaintext or a recognisable structure. Without it, brute force has no stopping rule.
  • The attack rate is constant. Hardware improves over the decades a long search would take. For any key at or above 112 bits this makes no practical difference, because the improvement is polynomial and the problem is exponential.
  • No side channels. Timing, power analysis, cache behaviour and fault injection recover keys without searching for them, and they are how real systems are broken.
  • Multi-target attacks are not modelled. An attacker who will accept breaking any one of 2t keys effectively faces a search of 2k−t. That matters at scale and is a reason to use per-user salts and nonces.
  • The Grover model is first order only. It ignores constant factors, the serial depth of the iteration, and quantum error correction — all of which make a real quantum attack far more expensive than the halved-bits figure suggests.

Key terms

Keyspace
The set of all values a key can take. For a k-bit key it has 2^k members, and its size is the upper bound on the work an exhaustive search requires.
Security strength
The number of bits of work an attacker must do to break a mechanism, expressed as a power of two. It equals the key length for a good symmetric cipher and is much lower than the modulus size for RSA or Diffie–Hellman.
Grover's algorithm
A quantum search algorithm that finds a marked item among N candidates in about √N queries. Against symmetric cryptography it halves the effective key length, which is why doubling the key restores the margin.
Landauer limit
The minimum energy any irreversible computation must dissipate to erase one bit: k_B · T · ln 2, which is about 2.87×10⁻²¹ J at 300 K. It sets a physical floor under the energy cost of a brute-force search.
Multi-target attack
An attack that succeeds by recovering any one key from a large set rather than one specific key. It reduces the effective search by the number of targets, which is why per-user salts and nonces matter.

Where key-search estimates fit in a real threat model

Exhaustive key search is the least likely way your data will be exposed, and calculating it is still worth doing — because it tells you when to stop worrying about key length and start worrying about everything else. Once the number is above about 1020 years, further increases buy nothing, and effort belongs elsewhere.

The historical record makes the point. DES fell in 1998 not because 56 bits was mathematically weak but because it was a fixed target while hardware improved for twenty years; the EFF's purpose-built machine simply ran the search this calculator describes. Everything since has been different in kind — protocol flaws, padding oracles, weak random number generators, keys left in source control, and social engineering. None of those appear in a keyspace calculation.

For an adjacent problem with the same flavour of exponential arithmetic, see the hash collision probability calculator: the birthday bound means a collision appears after roughly 2b/2 values rather than 2b, which is why a 128-bit digest offers only 64 bits of collision resistance. The halving there is structural, not quantum, and it catches people out for the same reason Grover does — the exponent, not the arithmetic, is where the intuition fails.

Frequently asked questions

How long would it take to brute force AES-256?

Longer than any physically meaningful interval. The expected search is 2255 = 5.79×1076 trials, which at a trillion keys per second is 1.83×1057 years — about 1047 times the age of the universe. Scaling the attacker up does not help: a billion-fold increase in hardware removes thirty bits and leaves 1048 years. AES-256 is not broken by brute force under any assumption about classical computing.

Is AES-128 still safe?

Against classical attackers, yes, by an enormous margin — the expected search is 5.39×1018 years at a trillion keys per second, and no realistic increase in hardware changes that conclusion. NIST SP 800-57 places 128-bit security strength in the acceptable range with no expiry date attached. The argument for moving to AES-256 is quantum: Grover's algorithm reduces AES-128 to about 64 bits of effective strength, which is within reach of the model, whereas AES-256 retains about 128.

Why do you divide by two to get the expected time?

Because a search in random order finds the key halfway through on average. If the key is uniformly distributed over N possibilities and your search order is uncorrelated with it, the expected position is (N+1)/2, which for large N is N/2 = 2k−1. The worst case is the full 2k, and this calculator reports both. The factor of two is one bit of key length, so it is negligible next to the exponential term.

Does adding more machines meaningfully shorten the search?

Only logarithmically in terms of key bits, which is the point. Brute force parallelises perfectly, so a million machines really do search a million times faster — but a million is about 220, so it removes twenty bits from the problem. Against a 128-bit key that leaves 108 bits, and the answer is still measured in astronomical time. Every doubling of an attacker's fleet is worth exactly one bit of key length.

What does a quantum computer do to my key length?

It halves the effective strength for symmetric ciphers, under the standard first-order model of Grover's algorithm. A 128-bit key behaves like a 64-bit one and a 256-bit key like a 128-bit one, which is why the usual recommendation is to double symmetric key lengths rather than to replace the algorithm. Asymmetric cryptography is a different story: Shor's algorithm breaks RSA and elliptic-curve systems outright rather than halving them, which is why post-quantum replacements are being standardised for those and not for AES.

What attack rate should I enter?

Start from hardware you can point at. Take a device's throughput in trials per second and multiply by how many the attacker can field. Rates differ by orders of magnitude between primitives — a single fast hash is far cheaper to evaluate than a full AES key schedule plus decryption plus a plaintext check — so use a figure for the operation you are actually modelling. When you are trying to establish that a key is safe, deliberately choose an implausibly generous rate; if the answer is still astronomical, the conclusion is robust.

Why is the energy figure sometimes more convincing than the time figure?

Because time can be bought with parallelism and energy cannot be avoided. Thermodynamics puts a floor under any irreversible computation: k_B·T·ln 2 per bit erased, about 2.87×10−21 J at room temperature. Even at that unreachable efficiency, and counting one bit erasure per trial, searching half a 128-bit keyspace requires about 136 TWh. Real hardware is many orders of magnitude less efficient than the limit, so the true figure is far larger. No amount of parallelism reduces the total energy.

Can I use this for RSA or elliptic-curve key sizes?

No. This calculator models exhaustive search over a symmetric keyspace. Asymmetric keys are attacked by mathematical algorithms far cheaper than exhaustive search, so a 3072-bit RSA modulus provides roughly 128 bits of security strength rather than 3072, and a 256-bit elliptic-curve key provides about 128. Use the security-strength equivalences published in NIST SP 800-57 to translate an asymmetric key size into the symmetric strength you can enter here.

What is a multi-target attack and why does it matter?

It is an attack that succeeds by recovering any one key out of many, rather than one specific key. If an attacker collects 2t ciphertexts encrypted under independent keys and is happy to break any of them, the expected work falls to about 2k−t. Harvest a million targets and you have removed twenty bits. The defence is to make targets non-interchangeable with per-user salts, per-message nonces and domain separation, which is standard practice in modern protocol design.

References