Jakojak.Tools
Input
Password
Cost Factor (Rounds)
10
Higher is safer and slower. Use 10 for production.
Hashing…
Result
Bcrypt Hash
Click Generate Hash to see the hash here.
Click to copy

What is bcrypt?

Bcrypt is a password hashing function that is slow on purpose. Each hash stores its version, its cost factor and a random salt. You use it to store passwords in a database, so a leaked table does not give attackers the passwords.

How to use the bcrypt generator

  1. Pick Generate or Verify.
  2. To make a hash, enter a password, set the Cost Factor (10 is a good default) and click Generate Hash.
  3. To check a hash, enter the password and the stored hash, then click Verify Password.
  4. Copy the hash into your database. Do not store the plain password.

Which cost factor should I use?

Each step of the cost factor doubles the time to hash. At cost 10, one hash takes about 100 ms on current hardware. That is fast enough for a login and slow for an attacker who tries billions of guesses. Use 10 to 12 in production, and raise the value as hardware gets faster.

Frequently Asked Questions

Is it safe to hash a real password here?

Yes. Bcrypt runs in your browser, and the password and the hash stay on your device. You can open the Network tab in DevTools to check that no request goes out.

What cost factor should I use in production?

Use 10 to 12. At cost 10, a hash takes about 100 ms on current hardware.

Why does the same password give a different hash each time?

Bcrypt adds a new random salt to each hash and stores the salt in the hash string. To verify, bcrypt reads the salt from the stored hash and hashes the password again with it.

Can I verify a hash from another bcrypt library?

Yes. Hashes that start with $2a$, $2b$ or $2y$ use the same format. Paste a hash from Node.js, Python or PHP and verify it as it is.

Why is a high cost factor so slow?

The slowness is the protection. If one hash takes 1 second, an attacker also needs 1 second for each guess.