Bcrypt Generator

Hash and verify passwords with real bcrypt, right in your browser.

  • Runs in your browser
  • Free, no sign-up

Create a hash

12

Check a password against a hash

Result Not checked yet

About the Bcrypt Generator

bcrypt is one of the standard ways to store passwords. Instead of saving the password itself, a website saves a bcrypt hash: a 60-character string made from the password, a random salt and a cost factor. When you sign in, the site hashes what you typed the same way and compares the results.

The Bcrypt Generator creates real bcrypt hashes with the cost factor you choose, from 4 to 15, and shows how long each cost takes on your device. The second panel checks whether a password matches an existing hash, whether it was made by PHP ($2y$), Node.js, Python or any other bcrypt library ($2a$ or $2b$).

It is handy for creating a test user, seeding a database, checking that a login bug is not a hashing bug, or learning how password hashing works. Hashing runs in your browser with bcryptjs, so neither the password nor the hash is sent anywhere.

How to use it

  1. Enter a passwordType it in the Password field on the left. Show reveals it so you can check for typos.
  2. Choose the cost factorDrag the slider from 4 to 15. The hint shows the number of rounds and how long one hash takes on this device; 10 to 12 is typical for web logins.
  3. Generate the hashClick Generate hash. A progress counter runs while bcrypt works, then the 60-character hash appears, ready to copy.
  4. Check a passwordOn the right, enter a password and paste a bcrypt hash, or click "Use the hash on the left". Then click Check password.
  5. Read the resultYou see whether the password matches, plus the version, the cost and the salt read from the hash.

Key features

Real bcrypt

Uses bcryptjs, a widely used implementation, so hashes work with PHP password_verify, Node.js, Python, Ruby, Java and Go libraries.

Adjustable cost

Every step up doubles the work: cost 10 is 1,024 rounds and cost 12 is 4,096. The time estimate is measured on your own device.

Random salt every time

Each hash gets a new random 16-byte salt, so the same password never gives the same hash twice.

Verify any version

Checks $2a$, $2b$ and $2y$ hashes and shows their version, cost and salt.

72-byte warning

bcrypt ignores everything after the first 72 bytes of a password. The tool warns you when a password is that long.

Private by design

Hashing and checking happen in your browser. Nothing is uploaded.

Examples

Anatomy of a bcrypt hash

Hashing "correct horse battery staple" with cost 10 gave this hash:

$2b$10$7HYLZ6qmmgDamZM30XUP7e0q5Ui3kExRbJjRlXqe3oxqSQhSBxLHK
PartMeaning
$2b$The bcrypt version
10$The cost: 2^10 = 1,024 rounds
Next 22 charactersThe salt: 7HYLZ6qmmgDamZM30XUP7e
Last 31 charactersThe hash itself

Generate the same password again and you get a completely different string, because the salt is new each time. Both hashes still match the password.

Checking a hash made by PHP

PHP's password_hash() made this hash of the same password:

$2y$10$FE.vHYaz8KqyOuSgPNwQLuKq0mKFCbTxUkUIRfjwXmckqmreWS0Ha

Paste it with "correct horse battery staple" and the result is The password matches, with Version 2y, cost 10, salt FE.vHYaz8KqyOuSgPNwQLu. Change the first letter to a capital C and it says The password does not match. In the other direction, PHP's password_verify() accepts the $2b$ hashes this tool creates.

Cost factor and time

CostRoundsRelative time
8256¼ of cost 10
101,0241×
124,0964×
1416,38416×

On our test machine, cost 10 took about a tenth of a second in the browser and cost 12 about 0.4 seconds. The hint under the slider measures your own device, and servers running native bcrypt are usually faster. Choose the highest cost your login page can afford, often around a quarter of a second per sign-in.

Something that is not bcrypt

Paste an MD5 hash such as 5f4dcc3b5aa765d61d8327deb882cf99 and the checker says Not a bcrypt hash: a bcrypt hash is 60 characters and starts with $2a$, $2b$ or $2y$.

Tips

  • In your own code, use your language's built-in password functions, such as password_hash() in PHP or the bcrypt package in Node.js. Use this tool for tests, seeds and checks.
  • Store the whole 60-character string. The version, cost and salt are part of it, so you never need a separate salt column.
  • Raise the cost over the years as hardware gets faster. Most libraries can detect an old cost at sign-in and rehash the password with the new one.
  • If a password may be longer than 72 bytes, such as a long passphrase in a non-Latin script, consider Argon2id instead, or follow your library's advice for long passwords.
  • Use a test password, not your real one, when you generate hashes for sample data or bug reports.

Common mistakes and limits

  • Comparing hashes as textTwo bcrypt hashes of the same password are always different because of the salt. Check a password with a verify function, never by generating a new hash and comparing strings.
  • Using MD5 or SHA-256 for passwordsFast hashes can be tried billions of times per second. bcrypt is slow on purpose, which is what makes stolen password hashes hard to crack.
  • Choosing a very high costEach step doubles the time. Cost 15 can take several seconds per sign-in, which slows your site and makes it easier to overload with login attempts.
  • Ignoring the 72-byte limitCharacters after the first 72 bytes do not change the hash, so two long passwords that start the same way would both match. Accented letters and emoji use 2 to 4 bytes each.
  • Thinking a hash can be reversedbcrypt cannot be decoded. Tools that claim to "decrypt" bcrypt are guessing passwords one by one.

Frequently asked questions

What is bcrypt?
A password hashing function from 1999, designed to be slow and salted. It is supported by almost every programming language and is still a solid choice for storing passwords.
What is the cost factor?
It sets how much work one hash takes: 2 to the power of the cost rounds. Cost 10 is 1,024 rounds; each step up doubles the time for you and for an attacker.
Which cost should I use?
10 to 12 is typical for web logins today. Pick the highest value that keeps a sign-in comfortably under a second on your server.
What is the difference between $2a$, $2b$ and $2y$?
They are versions of the same algorithm. $2b$ is the current one, $2y$ is what PHP writes, and $2a$ is older. Modern libraries accept all three, and this tool checks them all.
Why do I get a different hash each time?
Each hash uses a new random salt. That is intended: it stops attackers from using precomputed tables and hides users who share a password.
Can bcrypt hashes be decrypted?
No. bcrypt is a one-way function. The only way to find the password is to guess it and check each guess, which a high cost makes very slow.
Will the hash work with PHP, Node.js or Python?
Yes. The tool creates standard $2b$ hashes that password_verify() in PHP, bcrypt in Node.js and the bcrypt package in Python all accept.
Is my password sent anywhere?
No. bcryptjs runs in your browser, so the password and the hash stay on your device.