What is bcrypt?
bcrypt is a password hashing function designed in 1999 by Niels Provos and David Mazières, based on the Blowfish cipher. Unlike general-purpose hashes such as MD5 or SHA-256, which are built to be fast, bcrypt is built to be slow on purpose. That matters because an attacker who steals a database of password hashes can only recover passwords by guessing, and a slow hash makes every guess expensive.
bcrypt is also adaptive: it has a cost setting that you can raise as computers get faster, so the same algorithm stays hard to attack for decades. It generates its own random salt, so you do not have to manage one, and identical passwords never produce identical hashes.
What a bcrypt hash looks like
Every bcrypt hash is 60 characters long and has four parts, which this tool colours for you:
- Version, such as
$2y$. It names the variant of the algorithm. - Cost, such as
10$. This is the base-2 logarithm of the number of rounds, so a cost of 10 means 1,024 rounds. - Salt: 22 random characters that are stored inside the hash.
- Digest: the final 31 characters, which are the actual hash of the password.
The versions $2a$, $2b$ and $2y$ are names for the same algorithm as it was fixed over time. PHP writes $2y$, while Node.js and Python usually write $2b$. For normal passwords they all verify the same way, and most libraries accept every prefix. Use the prefix menu above to match what your software expects.
Choosing the cost factor
The cost is the main setting. Each increase of one doubles the work, for you and for an attacker. Choose the highest value that keeps logins fast enough on your own server, and raise it over time.
| Cost | Rounds | When to use it |
|---|---|---|
| 4 | 16 | Automated tests only. Far too weak for real passwords. |
| 8 | 256 | Below the recommended minimum. |
| 10 | 1,024 | The recommended minimum for new systems. |
| 12 | 4,096 | A strong default. Laravel uses 12 for new applications. |
| 13 and above | 8,192 and above | High-security systems with fast servers. Create these in your own code. |
This generator offers costs 4 to 12 and shows how many milliseconds the server needed, which gives you a feel for the effect. Timings vary with the hardware, so always measure on the machine that will run your logins.
Using bcrypt in your own code
In real applications, hash passwords with your framework or a maintained library, not with an online tool. In PHP:
$hash = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]);
if (password_verify($password, $hash)) {
// the password is correct
}
In Laravel, use Hash::make($password) and Hash::check($password, $hash). In Node.js, use the bcrypt package: await bcrypt.hash(password, 12). In Python, use the bcrypt package: bcrypt.hashpw(password, bcrypt.gensalt(12)).
Limits and alternatives
- 72-byte limit. bcrypt only reads the first 72 bytes of the input, so longer passwords are cut off. If you must accept very long passphrases, hash them with SHA-256 first and encode the result, or choose another algorithm.
- Not memory-hard. bcrypt needs little memory, so attackers can use graphics cards effectively. Argon2id was designed to resist this and is the current first choice for new systems where it is available.
- Still a solid choice. bcrypt has been used and studied for more than 25 years, it is supported everywhere, and a well-chosen cost makes it very hard to attack.
How this tool works, and your privacy
bcrypt cannot be done natively in a web browser, so this tool calculates the hash on our server. Your text is sent over an encrypted HTTPS connection, hashed in memory, returned to you and discarded. It is not saved to a database, written to a log or shared, and responses are marked so browsers do not cache them. Requests are rate limited to protect the service.
Do not paste a real production password into any online tool. Use a test value instead, or generate the hash in your own code.