bcrypt hash generator and checker
Runs in your browserCreate bcrypt password hashes ($2y$, $2b$), check a password against a hash and measure the cost factor on your device.
- bcrypt hash
- Time on this device
What’s in a bcrypt hash
$2y$12$R9h/cIPz0gi.URNNX3kh2OPST9/PgBkqquzi.Ss7KIUgO2t0jWMUW: version (2y), cost (12 means 212 = 4,096 rounds of the key schedule), 22 characters of salt and 31 characters of hash. Because the salt is inside, the same password gives a different hash every time, and checking needs nothing but the hash.
Hash and verify with the standard libraries
$hash = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]);
if (password_verify($password, $hash)) { /* ok */ }
if (password_needs_rehash($hash, PASSWORD_BCRYPT, ['cost' => 12])) { /* store a new hash */ }import bcrypt h = bcrypt.hashpw(password.encode(), bcrypt.gensalt(12)) bcrypt.checkpw(password.encode(), h)
import bcrypt from "bcrypt"; // or "bcryptjs" const hash = await bcrypt.hash(password, 12); await bcrypt.compare(password, hash);
htpasswd -bnBC 12 "" 'password' | tr -d ':\n'
Limits of bcrypt
bcrypt only reads the first 72 bytes of the password. Longer passphrases (or 25 emoji) are cut; the tool warns you.
Same algorithm, different labels: PHP writes $2y$, OpenBSD, Python and Node $2b$. Most libraries accept both; for $2a$ and $2x$ see the FAQ.
Cost 10 was the default in 2010. Aim for about 100–250 ms on your server, today usually 11 to 12.
For new systems Argon2id is the recommendation of OWASP and RFC 9106. bcrypt is still fine.
Questions about the bcrypt generator
Can bcrypt be decrypted?
No. bcrypt is a one-way password hash. The only way to “reverse” it is to guess passwords and hash each one, which the cost factor makes slow on purpose. Why hashes can’t be decrypted.
What is the difference between $2a$, $2b$ and $2y$?
$2a$ is the original. $2y$ (PHP) and $2b$ (OpenBSD) were introduced in 2011 and 2014 after bugs in some implementations with non-ASCII passwords and very long passwords. For passwords that are ASCII and shorter than 72 characters all three give the same result.
Which cost should I choose?
As high as your login can afford: about a quarter of a second per check on your server. Measure with the button above; servers are often faster than laptops.
Is my password sent anywhere?
No. bcrypt runs in your browser as WebAssembly. Nothing is uploaded.