Bcrypt generator
Generate a salted bcrypt hash with a cost factor from 4 to 14, or paste a hash and a password to see whether they match. The slow work runs in a background worker in your browser, so the page stays responsive, and the password never leaves your device.
Runs in your browser: nothing you enter is sent anywhere.
How to use it
- Choose “Create hash”, type a password, pick a cost and press Hash. The progress bar shows the work; Cancel stops it.
- To check an existing hash, choose “Verify”, paste the hash and the password, and press Verify.
- Copy the hash into your code or database.
How it works
bcrypt is built on the Blowfish cipher. It runs an expensive key setup (EksBlowfishSetup) in which the password and a 16-byte salt are mixed into Blowfish’s state 2^cost times, then encrypts the text OrpheanBeholderScryDoubt 64 times. The first 23 bytes of the result are written in bcrypt’s own Base64 alphabet after the prefix.
A hash looks like $2b$10$ + 22 characters of salt + 31 characters of hash: version, cost, salt, result. Verifying re-runs the algorithm with the salt and cost from the hash and compares the results.
Known vector (from the crypt_blowfish test suite): the password U*U with the salt CCCCCCCCCCCCCCCCCCCCC. and cost 5 gives $2a$05$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW. You can paste that hash into Verify to check it.
Tips
- Costs of 10 to 12 are common for logins; choose a value that takes a noticeable fraction of a second on your server.
- Store the whole string; the salt and cost are inside it.
- bcrypt truncates at 72 bytes, so pre-hashing very long passphrases is a common precaution.
Frequently asked questions
What does the cost factor mean?
The cost is the base-2 logarithm of the number of key-setup rounds, so each step up doubles the work. Pick the highest cost your login server can afford; this tool allows 4 to 14.
Why is the hash different every time?
Each hash includes a fresh random salt, stored in the hash itself. Two hashes of the same password differ but both verify, and identical passwords no longer share a visible hash.
What is the difference between $2a$, $2b$ and $2y$?
They are revisions of the same algorithm that mainly differ in how old implementations handled long or unusual passwords. This tool computes them the same way, and $2b$ is the common current prefix.
Is there a password length limit?
Yes. bcrypt uses at most 72 bytes of the UTF-8 encoded password, and the tool warns when you go past that. Characters outside basic ASCII take more than one byte.
Is it safe to hash real passwords here?
The hashing runs entirely in your browser and nothing is sent to a server. Even so, avoid typing a live production password into any web page; use this for tests, examples and learning.