Bcrypt Hash Generator

Generates a real bcrypt hash with a configurable cost factor and a cryptographically random salt embedded in the output. Unlike the general-purpose hashes, bcrypt is designed for exactly one job: storing passwords in a way that survives a database breach.

Live demo · real result from this tool
Mode
Each step doubles the work. OWASP: at least 10.

Press Generate to create a result.

Processed on your device — nothing is uploaded.

How to use Bcrypt Hash Generator

  1. Enter the password to hash.
  2. Choose a cost factor — 12 is a reasonable default on current hardware.
  3. Generate, and store the entire output string in one column.
  4. The salt is generated randomly and embedded in the output — do not store one separately.
  5. Each cost increment doubles the computation time; aim for 200–500ms on your production hardware.
  6. bcrypt truncates input at 72 bytes, which matters if you accept long passphrases.

Why a password hash has to be slow

SHA-256 is designed to be fast, and a GPU computes billions a second — which is the whole problem when the input is a human-chosen password from a list of a few hundred million. bcrypt is deliberately slow, and the cost factor controls how slow. Each increment doubles the work: cost 10 is roughly 100ms, cost 12 about 400ms, cost 14 about 1.6 seconds. That is imperceptible for one login and catastrophic for an attacker trying a dictionary, which is precisely the asymmetry you are buying.

Reading the hash string

A bcrypt hash looks like $2b$12$R9h/cIPz0gi… and is self-describing. $2b$ is the algorithm version, 12 is the cost factor, the next 22 characters are the salt, and the rest is the digest. Everything needed to verify a password is in that one string, which is why you store a single column and never a separate salt. It also means the cost is recorded per hash, so you can raise it for new passwords and rehash old ones on next login without breaking anyone.

The salt is the reason rainbow tables fail

Every hash gets a fresh random salt, so the same password hashed twice produces two completely different strings. That defeats precomputed tables outright — an attacker cannot build one table and test it against every account, they must attack each password separately. It also means two users with the identical password have no visible relationship in your database, which unsalted hashes leak immediately.

Where bcrypt now sits

It has one real limitation: input is truncated at 72 bytes, so a very long passphrase is silently cut short — which matters if you allow long inputs and assume they all count. Argon2id is the current recommendation from OWASP and the winner of the Password Hashing Competition, because it is memory-hard as well as slow, which resists custom hardware in a way bcrypt does not. scrypt is a reasonable middle ground. bcrypt remains entirely acceptable and is not broken — if you already use it at a sensible cost, that is not the weak point in your system.

Frequently asked questions

Why use bcrypt for passwords?
Bcrypt is deliberately slow and includes a salt, so it resists brute-force and rainbow-table attacks far better than MD5 or SHA.
What is the cost factor?
The work factor (rounds) — each increment doubles the hashing time. 10 to 12 is a common, sensible range.
Do I need to store the salt separately?
No — bcrypt embeds the salt and cost inside the hash string, so a single value is all you store.
What cost factor should I use?
Pick the highest that keeps a login under about 250ms on your actual production hardware — usually 12 today, sometimes 13 or 14 on fast servers. Measure rather than guessing: the right cost depends on your machine, and it should be raised as hardware improves.
Why does the same password give a different hash each time?
Because a fresh random salt is generated per hash and embedded in the output. That is the point: identical passwords produce unrelated hashes, so precomputed tables are useless and your database does not reveal which users share a password.
Should I use bcrypt or Argon2?
Argon2id for new systems — it is the current OWASP recommendation and memory-hard, which resists GPU and custom-hardware attacks better. bcrypt is not broken and remains a perfectly defensible choice, particularly if it is already in place; migrating is lower priority than most other security work.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Guides

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close