What is the bcrypt cost factor and why does it matter?
bcrypt has been the industry standard for over 20 years. Every login in your app is a password hash + compare with the database. The slower the hash, the harder it is for an attacker to guess passwords by trying millions of combinations. Enter the "cost factor": a parameter that exponentially scales compute time.
Cost 10 = ~10 ms per hash (fast hardware, fast user login). Cost 12 = ~40 ms. Cost 14 = ~160 ms. Cost 16 = >0.5 s (noticeably slow login). Trade-off: too low = easy brute force. Too high = bad UX and higher server cost.
OWASP recommends in 2025: aim for 250-500 ms per hash on your production hardware. Run the benchmark here on your machine, see the cost factor that lands in that window.
Everything runs locally. Your test password never leaves the browser.
How to use
- Click Run benchmark. The tool hashes a sample password at cost factors 4, 6, 8, 10, 12, 14 (three times each).
- A moment later you see the chart: Y axis is milliseconds, each bar is a different cost. Bars grow exponentially (each cost is 2x slower than the previous).
- Recommendation: the highest cost that still fits inside the 250-500 ms window (green bar). Put that number in your app config.
- Below: Quick-test lets you hash any password at any cost and see the exact time + the bcrypt hash for that password on this device.
- Remember: the cost on your laptop is not the cost on your production server. Run the benchmark on the actual hardware where your app will run.
When to use it
Five common situations where a cost analyzer helps:
- Picking a cost for a new app. You are hashing user passwords for the first time, you need a cost. The benchmark tells you: on this VPS, cost 12 is 280 ms, perfect.
- Migrating to a stronger cost. Your app has used cost 10 for 3 years, time to bump it. The benchmark shows cost 13 is now only 200 ms on the new servers.
- Diagnosing slow logins. Users complain about 2-second logins. Benchmark: ah, the team set cost 16, way too high for this box.
- Hardware comparison. Old server vs new AWS instance, how much cost can you afford?
- Team education. Show a junior how the cost factor works and why MD5 is not enough.
To generate other hashes (SHA-256, MD5, Argon2), use the password hash generator. To check if a password leaked, use pwned passwords.