Skip to content
ENExplore Calculators

Bcrypt Cost Factor Calculator

Work out bcrypt cost factor instantly with clear inputs, formula shown and shareable results.

About Bcrypt Cost Factor Calculator

bcrypt's cost factor is a base-2 exponent: cost 12 performs 4,096 key-setup rounds and takes twice as long as cost 11. Because the work doubles per increment, the practical ceiling is set by your login throughput — at 20 logins per second and 250 ms per hash, five CPU cores do nothing but verify passwords, which is also exactly the denial-of-service surface an attacker will probe.

Formula

bcrypt cost scaling

time = baseline x 2^(cost - 10); rounds = 2^cost; CPU cores = logins per second x time

Worked example

With the default values below, Bcrypt Cost Factor Calculator returns Time to verify one password of 240.0. Change any input above and every figure here is recalculated in your browser.

Inputs used

bcrypt cost factoraccepts 4–20
12
Measured time at cost 10minimum 0.1 ms
60 ms
Peak logins per secondminimum 0.01
20

Results

Time to verify one password
240.0 ms
Key-setup iterations (2^cost)
4,096
CPU cores needed at peak login rate
4.80
Comparison with published guidance
Cost 12 or above meets current OWASP guidance

Step by step

  1. 1Values used
  2. 2bcrypt cost scaling
  3. 3Time to verify one password= 240.0 ms
  4. 4Key-setup iterations (2^cost)= 4,096
  5. 5CPU cores needed at peak login rate= 4.80
  6. 6Comparison with published guidance= Cost 12 or above meets current OWASP guidance

Assumptions and limits

  • The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax or compounding frequency into account.
  • Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

What cost factor should I use?

Pick the highest cost that keeps verification under about 250 ms on your hardware. That is usually 12 or 13 on modern servers, and should be re-measured every few years.

Why does bcrypt cap passwords at 72 bytes?

The algorithm's key schedule only consumes 72 bytes of input. Longer passwords are silently truncated, so pre-hash with SHA-256 if you must accept long passphrases.

Bcrypt Cost Factor Calculator | Calcrivo