Skip to main content
Preparing workspace

Bcrypt Hash Generator & Verifier

Generate bcrypt password hashes at cost 4–31 and check a password against a $2a$, $2b$ or $2y$ hash. Shows cost, salt and digest. Runs in your browser.

Still loading. If the tool doesn’t appear, reload this page.

About this tool

Bcrypt Hash Generator & Verifier

Generate a bcrypt password hash at any cost factor, verify a password against a $2a$, $2b$ or $2y$ hash, and see the hash's cost, salt and digest. Runs locally in your browser.

Bcrypt is a deliberately slow password-hashing function: it mixes the password with a 16-byte random salt, then repeats its expensive key-expansion loop 2^cost times, so cost 10 means 1,024 iterations. This tool generates bcrypt hashes at the cost you choose, verifies a password against an existing $2a$, $2b$ or $2y$ hash, and splits the hash into its parts.

How to use Bcrypt Hash Generator & Verifier

  1. 1

    Choose Generate, type a test password and pick a cost factor; 10 or more is the OWASP minimum for real use.

  2. 2

    Pick the prefix your platform expects: $2b$ for most libraries, $2y$ for PHP and Laravel.

  3. 3

    Press Generate hash and copy the 60-character result.

  4. 4

    To check a password, choose Verify, enter the password and paste the hash, then press Verify password.

Why use Bcrypt Hash Generator & Verifier

  • Generate and verify

    Hash at any cost from 04 to 31 with a $2b$, $2y$ or $2a$ prefix, or check a password against an existing hash.

  • Explains the hash

    Splits a hash into revision, cost, 22-character salt and 31-character digest, and says exactly why a malformed one cannot be used.

  • Honest about speed

    Times bcrypt on your device and estimates how long the chosen cost will take, warning before a run that could keep the tab busy for minutes.

  • Local only

    Uses the open-source bcryptjs library (BSD-3-Clause) inside your browser; nothing is uploaded. Still, use test values, not production secrets.

Bcrypt hash anatomy

The parts of a 60-character bcrypt hash (cost 12, test password "correct horse battery staple"): $2b$12$CCCCCCCCCCCCCCCCCCCCC.aNFuLnJDpfCit2UcMXRRsawH6O4VbfG
PartExampleMeaning
Revision$2b$Algorithm revision: $2a$, $2b$ or $2y$
Cost12$Work factor; key setup runs 2^12 = 4,096 times
SaltCCCCCCCCCCCCCCCCCCCCC.16 random bytes, 22 characters of bcrypt base64
DigestaNFuLnJDpfCit2UcMXRRsawH6O4VbfGFirst 23 bytes of the 24-byte output, as 31 characters of bcrypt base64

Bcrypt's base64 alphabet is ./A–Z a–z 0–9, not the standard one. The example is a test vector, not a real password.

Common use cases

  • Creating a bcrypt hash to seed a test user or an admin account in a development database.
  • Checking whether a test password matches a hash from a config file, fixture or bug report.
  • Reading a hash's cost factor to see whether stored passwords fall below the OWASP minimum of 10.
  • Seeing how much slower each cost step is on your own device before choosing one for a server.

Frequently asked questions

How do I verify a bcrypt hash?

Hash the candidate password again using the salt and cost stored in the hash, then compare the results. Libraries do this in one call, such as bcrypt.compare() in Node or password_verify() in PHP. In this tool, choose Verify, enter the password and paste the hash.

What cost factor should I use for bcrypt?

At least 10. The OWASP Password Storage Cheat Sheet sets a work factor of 10 as the minimum for bcrypt, which it lists for legacy systems; its first choice for new systems is Argon2id. Raise the cost as far as your login latency allows: each step doubles the work, so cost 12 is four times slower than cost 10. Time it on your production hardware, not in a browser.

What is the difference between $2a$, $2b$ and $2y$?

They are revision markers for the same algorithm. $2b$ is OpenBSD's 2014 fix for a length bug with passwords of 255 bytes or more, and $2y$ is how Openwall's crypt_blowfish, used by PHP since 5.3.7 (2011), marks hashes from its corrected code. For ordinary passwords all three give the same digest, so most libraries verify any of them.

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

Every hash uses a fresh 16-byte random salt, stored as the 22 characters after the cost. Different salts give different hashes, yet each one still verifies, because the verifier reads the salt back out of the stored hash.

Is there a maximum password length for bcrypt?

Yes. Bcrypt uses only the first 72 bytes of the password and silently ignores the rest. A byte is not a character: é takes 2 bytes in UTF-8 and most emoji take 4. The tool counts bytes as you type and warns when the limit is passed.

Can a bcrypt hash be decrypted?

No. Bcrypt is a one-way hash, not encryption, so there is no key that turns it back into the password. Cracking means guessing passwords and hashing each guess at the stored cost, which is exactly the work a high cost factor makes slow.

Is it safe to generate bcrypt hashes online?

This page never sends your input anywhere: hashing runs in your browser. Still, treat any web page as untrusted for real credentials. Use it for test values, and hash production passwords on your own server with a maintained library.