Bcrypt generator
Generate a bcrypt hash with a cost slider and verify a password against an existing hash. Output matches PHP password_hash() and password_verify(). Runs in your browser.
Generate a hash
Verify a password
No account, uploads or PHP execution. Your inputs stay on this device.
What this bcrypt generator does
It runs the bcrypt algorithm in your browser and produces the same 60-character string as PHP's password_hash($password, PASSWORD_BCRYPT). The verifier does what password_verify() does: it reads the cost and salt from the stored hash, hashes the password again and compares. Nothing is sent anywhere, so you can test real values, but treat any password you paste into a web page as exposed and rotate it if it matters.
Anatomy of a bcrypt hash
$2y$10$LgDvC/qmVt.lDTfpUUMo/eUUdxNwPcjMleX5yhflvQR.SPMUIg8ta
$2y$ algorithm variant
10$ cost: 2^10 = 1,024 rounds of key setup
LgDvC/qmVt.lDTfpUUMo/e 22 characters of random salt
UUdxNwPcjMleX5yhflvQR.SPMUIg8ta 31 characters of hash$2y$ is what PHP writes. $2b$ is the same algorithm as written by OpenBSD, Node and Python libraries, and $2a$ is the older label. password_verify() accepts all three, so hashes move between languages without rehashing. The salt is stored inside the hash, which is why you never store it separately.
Hashing and verifying in PHP
$hash = password_hash($password, PASSWORD_DEFAULT); // bcrypt today
$hash = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]);
if (password_verify($input, $hash)) {
if (password_needs_rehash($hash, PASSWORD_DEFAULT, ['cost' => 12])) {
$hash = password_hash($input, PASSWORD_DEFAULT, ['cost' => 12]);
// save the new hash
}
// logged in
}Store the result in a column of at least VARCHAR(255): PASSWORD_DEFAULT may switch to a longer algorithm in a future release. Never compare hashes with ==; use password_verify().
Choosing a cost
Each step up doubles the work. PHP 8.4 raised the default cost from 10 to 12. Aim for roughly 100 to 300 milliseconds per hash on your production servers: slow enough to make offline guessing expensive, fast enough that logins stay snappy and a burst of sign-ins does not exhaust your CPU. Times shown by this tool are for your browser, which is usually slower than a server running native code. Raising the cost later is easy, because password_needs_rehash() upgrades each user at their next login.
The 72-byte limit
bcrypt only uses the first 72 bytes of a password, counted in UTF-8, so a long passphrase with emoji or accented letters reaches the limit sooner than its character count suggests. Bytes past the limit are ignored silently, and the tool warns you when that happens. If you need longer inputs, Argon2id (PASSWORD_ARGON2ID) has no such limit. Avoid pre-hashing with raw SHA-256 output, which can contain NUL bytes that cut the password short.