EthicalFusion

Bcrypt Hash Generator

Generate a secure bcrypt hash for passwords.

Was this tool helpful?

Thanks for the feedback!

This Bcrypt Hash Generator creates a password hash with PHP's password_hash() function using the bcrypt algorithm at cost 10. Developers use it to set a password directly in a database, seed an admin account, or produce test fixtures for login code. Type the password, press Generate bcrypt, and copy the 60-character result.

Reading a bcrypt hash

A hash produced by this page looks like this:

$2y$10$wrtlcZ.TfdNXIC1IPY4NEuqTNd/187zxLwuq.zP8JvR/pytnhHWey
PartValueMeaning
Prefix$2y$bcrypt, PHP's label for the fixed variant
Cost10$2 to the power 10, i.e. 1,024 rounds of key setup
Saltnext 22 charactersrandom, new on every click
Hashlast 31 charactersthe result itself

Because the salt is random, pressing the button twice for the same password gives two different hashes. Both are correct. The salt and cost are stored inside the string, which is why a verifier needs nothing except the hash and the password someone types.

Checking a hash in your code

In PHP, password_verify('MyS3cret!', $hash) returns true for a hash made from MyS3cret!. Laravel's Hash::check() uses the same routine. Libraries in other languages usually treat $2y$ and $2b$ as the same algorithm. To set a password by hand in MySQL, generate the hash and run something like UPDATE users SET password = '$2y$10$…' WHERE email = 'admin@example.com';, pasting the full 60 characters.

Limits you should know

  • 72-byte ceiling. Bcrypt only looks at the first 72 bytes. A password of 72 "a" characters and the same string with "EXTRA" appended produce hashes that verify each other. Hindi and other Indic scripts use three bytes per character in UTF-8, so the limit arrives after about 24 characters.
  • Edge spaces are removed. The server trims spaces and line breaks at the start and end of the input before hashing, so a password that really begins or ends with a space will not match the hash.
  • Fixed cost. The work factor is always 10. Laravel's default is now 12, which is four times slower to compute; a cost-10 hash still verifies there, and the framework can rehash it at the user's next login.

Why bcrypt instead of MD5 or SHA-256

Fast hashes are built to process gigabytes per second, which also lets an attacker test billions of guesses. Bcrypt is deliberately slow and salted, so identical passwords don't share a hash and precomputed tables are useless. The OWASP Password Storage Cheat Sheet accepts bcrypt with a work factor of 10 or more where Argon2id isn't available. A fast checksum like the MD5 Hash Generator is fine for file fingerprints but never for passwords.

This runs on the server: your text travels over HTTPS to PHP and the hash comes back, so for live production passwords it is better practice to hash inside your own application. For choosing a strong password first, try the Password Generator.

Frequently asked questions

Why do I get a different bcrypt hash every time?
Each hash includes a new random 22-character salt. All of them verify against the same password, so any one can be stored.
Can a bcrypt hash be decrypted back to the password?
No. Bcrypt is one-way. The only attack is guessing passwords and hashing each guess, which the cost factor makes slow.
What does $2y$10$ mean at the start?
$2y$ identifies the bcrypt variant used by PHP, and 10 is the cost, meaning 2 to the power 10 rounds of the expensive setup step.
Is there a maximum password length for bcrypt?
Yes, bcrypt uses only the first 72 bytes. Anything after that is ignored when hashing and when verifying.
Will this hash work with Laravel?
Yes. With Laravel's default bcrypt driver, Hash::check verifies a $2y$ hash of any cost. For other frameworks, test one login before changing real accounts.

Related tools

People also used

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.