SuperDevTools

Bcrypt generator: hash and verify passwords

Generate a bcrypt hash

Verify a password

Nothing is sent: hashing and verification run in your browser, on your device.

A bcrypt generator that runs in your browser

This bcrypt generator turns a password into a bcrypt hash, the format well-built applications use to store their users' passwords. It also does the other job you need day to day: telling you whether a password matches an existing hash.

All the work happens in your browser, in a background worker so the page stays responsive. Nothing is sent: neither the password nor the hash leaves your device. Only your chosen cost and prefix are remembered for your next visit.

How to generate a hash

  1. Type your text into "Password". Tick "Show password" to see what you type. Below the field, a counter shows how many of the 72 available bytes you are using.
  2. Pick the "Cost (work factor)", from 4 to 14. The default is 10.
  3. Pick the "Prefix": $2y$, $2b$ or $2a$.
  4. Click "Generate hash" or press Enter. A random 16-byte salt is drawn, then the hash appears together with the time it took.
  5. "Copy hash" puts it on the clipboard; "Test this hash" copies it into the verification section.

To check a password, fill in "Password to test" and "Bcrypt hash to compare", then click "Verify". The answer is a plain yes or no: the password matches this hash, or it does not.

Anatomy of a bcrypt hash

A bcrypt hash is always 60 characters long. Take the published test hash for the empty password at cost 6. Here it is in full, then split into the four parts the tool shows:

PartValueMeaning
Full hash$2a$06$DCq7YPn5Rq63x1Lad4cll.TV4S6ytwfsfvkgY8jIucDrjc8deX1s.60 characters in total
Prefix$2a$the algorithm variant
Cost062 to the power of 6, so 64 rounds
SaltDCq7YPn5Rq63x1Lad4cll.16 random bytes in 22 characters
HashTV4S6ytwfsfvkgY8jIucDrjc8deX1s.the result, in 31 characters

The salt is stored inside the hash itself. That is why clicking "Generate hash" twice with the same password gives two different results, and why verification still works. Paste this hash, leave the password field empty and click "Verify": the tool confirms the match.

Which cost should you use?

Every extra point of cost doubles the work. Cost 10 means 1,024 rounds, cost 12 means 4,096 and cost 14 means 16,384, so cost 14 takes 16 times longer than cost 10. Aim for a fraction of a second per check on your server: nobody notices it at login, but an attacker testing billions of leaked passwords pays that price every single time. After your first hash, the tool estimates how long other costs would take on your device, and from cost 12 upwards a warning reminds you that the wait doubles with each step.

PHP's password_hash uses bcrypt with a default cost of 10 up to PHP 8.3 and 12 from PHP 8.4. Bcrypt is slow on purpose, unlike a SHA256 generator, which is fast by design and therefore a poor fit for storing passwords. It is also far stronger than the old DES-based CRYPT encrypt.

Common uses

  • Seeding an admin account straight into the database of a web app, before any sign-up form exists.
  • Writing a line for an .htpasswd file to password-protect a folder on a web server; the $2y$ format is accepted there.
  • Checking during a support call or a bug hunt whether the password a customer remembers matches the stored hash.
  • Filling a test fixture with realistic hashes at a low cost such as 4, so your test suite stays fast.

Hashing protects a password, it does not make it any better: start from a long secret made with a password generator.

FAQ

Why does bcrypt stop at 72 bytes?

The algorithm only reads 72 bytes of key. Anything after that is ignored, so two passwords sharing the same first 72 bytes produce the same hash. An accented letter such as "é" takes 2 bytes in UTF-8 and an emoji takes 4, so 36 accented letters already reach the limit. The counter warns you as soon as you go over.

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

They mark successive fixes for flaws in some older implementations. With current code, the same password and salt give the same hash under all three prefixes. Use $2y$ for PHP and $2b$ for most other languages; the verification section accepts all three.

Can a password be recovered from its hash?

No. Bcrypt is a one-way hash, not encryption. The only way to "recover" a password is to guess again and again, and the cost exists precisely to make each guess slow.

Is my password sent to a server?

No. The computation runs entirely in your browser, on your device.