Bcrypt Hash Generator and Checker

Create a salted bcrypt hash for any password, choose the cost factor, and check whether a password matches an existing bcrypt hash — all computed on your device.

Generate a bcrypt hash

Each +1 doubles the work. 10–12 is typical for web logins in 2026.

Verify a password against a bcrypt hash

What is bcrypt?

bcrypt is a password hashing function designed in 1999 by Niels Provos and David Mazières. Unlike general-purpose hashes, it is intentionally slow and includes a random salt, so identical passwords produce different hashes and precomputed “rainbow tables” are useless. Its cost factor lets you make hashing slower as hardware gets faster.

Anatomy of a bcrypt hash

A bcrypt hash looks like $2b$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy:

  • $2b$ — the version. $2a$, $2b$ and $2y$ (PHP) are compatible for normal passwords.
  • 10 — the cost: 2¹⁰ = 1,024 rounds of the expensive key setup.
  • Next 22 characters — the 128-bit salt, Base64-encoded.
  • Last 31 characters — the 184-bit hash itself.

Choosing a cost factor

Each step up doubles the time to compute one hash — for you and for an attacker. Pick the highest cost your server can afford while keeping login latency acceptable (OWASP suggests a minimum of 10):

Typical bcrypt timings
CostIterationsTypical server time
101,024~50–100 ms
124,096~200–400 ms
1416,384~1–1.5 s

Browser JavaScript is slower than native code, so the progress bar above will take longer than your server would.

Important limits

  • 72-byte limit. bcrypt ignores everything after the first 72 bytes of the password. Multi-byte characters (emoji, accented letters) use more than one byte each.
  • Not for encryption. A hash cannot be decrypted; you can only verify a guess against it.
  • Consider Argon2id for new systems — it is memory-hard and more resistant to GPU attacks — but bcrypt remains a solid, widely supported choice.

Code examples

Node.js: await bcrypt.hash(password, 12) and await bcrypt.compare(password, hash). PHP: password_hash($pw, PASSWORD_BCRYPT, ['cost' => 12]) and password_verify($pw, $hash). Python: bcrypt.hashpw(pw.encode(), bcrypt.gensalt(12)).

Uses bcrypt.js by Daniel Wirtz (Apache License 2.0).

Last updated: · Reviewed by the Password Generator team

Frequently asked questions

Can bcrypt be decrypted?

No. bcrypt is a one-way hash, not encryption. The only way to recover a password is to guess it and compare, which bcrypt deliberately makes slow.

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

They are revisions of the same algorithm that fixed edge-case bugs in some implementations. For ordinary passwords they produce compatible results; this tool generates $2a$ and verifies all three.

What cost factor should I use?

At least 10, and ideally 12 or higher if your servers can hash a password in roughly 250 ms or less. Increase it over time as hardware improves.

Why does the same password give a different hash every time?

Because bcrypt generates a new random salt for every hash. Verification works because the salt is stored inside the hash string.