Check a bcrypt hash made by PHP
secret123
✓ password_verify() returns true
This $2y$ hash was created by PHP's password_hash(), the same format Laravel and most PHP apps store.
Create password hashes exactly like PHP's password_hash() does, with bcrypt or Argon2id, and get ready-to-paste PHP, SQL and Laravel code. Test any stored hash with password_verify().
PASSWORD_DEFAULT (bcrypt) for most apps, or PASSWORD_ARGON2ID if your PHP supports it.PASSWORD_DEFAULT, pick your PHP version: PHP 8.4 raised the default bcrypt cost from 10 to 12.password_needs_rehash() would return true with your current settings.secret123
✓ password_verify() returns true
This $2y$ hash was created by PHP's password_hash(), the same format Laravel and most PHP apps store.
secret123
✓ password_verify() returns true
PHP's default Argon2id settings: 64 MiB of memory, 4 iterations, 1 thread.
correct horse battery staple
$2y$12$… plus ready PHP, SQL and Laravel code
Each hash is different because of the random salt. Copy the SQL line to reset a user's password directly in the database.
PHP has a built-in password API: password_hash() creates a salted, slow hash, and password_verify() checks a password against it. The algorithm, cost and salt are all stored inside the hash string, so you only need one database column and never have to manage salts yourself. This tool produces hashes in exactly the same format, so they work with password_verify() in any PHP application.
| Constant | Algorithm | Hash starts with | Default settings |
|---|---|---|---|
PASSWORD_DEFAULT | bcrypt (today) | $2y$ | cost 12 in PHP 8.4+, cost 10 before |
PASSWORD_BCRYPT | bcrypt | $2y$ | same, cost adjustable |
PASSWORD_ARGON2ID | Argon2id | $argon2id$ | 64 MiB memory, time cost 4, 1 thread |
PASSWORD_ARGON2I | Argon2i | $argon2i$ | same as Argon2id |
PASSWORD_DEFAULT may change to a stronger algorithm in a future PHP version. That is why the PHP manual recommends storing hashes in a column of at least 255 characters. Argon2 is only available if PHP was built with Argon2 support; check with defined('PASSWORD_ARGON2ID').
// 1. When a user registers or changes their password$hash = password_hash($password, PASSWORD_DEFAULT); // 2. When a user logs inif (password_verify($password, $user->password)) { // 3. Upgrade old hashes after a successful login if (password_needs_rehash($user->password, PASSWORD_DEFAULT)) { $user->password = password_hash($password, PASSWORD_DEFAULT); $user->save(); }}password_needs_rehash() returns true when a stored hash uses a different algorithm or weaker settings than the ones you pass. Calling it after every successful login moves all users to stronger hashes over time, without forcing password resets.
Locked out of your own admin account? Generate a hash here and run the SQL shown under the tool:
UPDATE users SET password = '$2y$12$…' WHERE email = '[email protected]';Keep the hash inside single quotes: in many shells and some languages, $ inside double quotes is treated as a variable and the hash gets corrupted.
Both are good password hashes. bcrypt is supported everywhere and is the PHP default. Argon2id is the newer recommendation from security experts because it is also memory-hard, which makes GPU cracking much more expensive, and it has no 72-byte password limit. If your PHP supports Argon2id and all your servers do too, it is the stronger choice.
Laravel's Hash::make() uses password_hash() under the hood, with bcrypt and a cost of 12 by default (set by BCRYPT_ROUNDS). Switch to Argon2id in config/hashing.php with 'driver' => 'argon2id'. Hashes from this tool work with Hash::check().
password_verify() returns false for a correct password
The most common cause is a column that is too short: a VARCHAR(50) cuts a 60-character bcrypt hash or a ~97-character Argon2id hash. Use VARCHAR(255). Also check the hash was not changed by $ being expanded in double quotes.
Fatal error: Undefined constant PASSWORD_ARGON2ID
Your PHP was built without Argon2 support. Use PASSWORD_DEFAULT (bcrypt), or install a PHP build with libargon2 or libsodium.
Every hash of the same password is different
That is correct: password_hash() adds a new random salt each time. Never compare hashes with ==; always use password_verify().
Logins got slow after upgrading to PHP 8.4
PHP 8.4 raised the default bcrypt cost from 10 to 12, which is four times more work. It is safer; if your server struggles, pass ['cost' => 11] explicitly.
Yes. The hashes use exactly the same format as password_hash(), so password_verify() and Laravel's Hash::check() accept them.
bcrypt, producing $2y$ hashes. Since PHP 8.4 the default cost is 12; before that it was 10.
bcrypt hashes are 60 characters and Argon2id hashes are around 97 with the default settings. Store them in a VARCHAR(255) column so future algorithms also fit.
No. The salt, algorithm and cost are all part of the hash string. password_verify() reads them from there.
Everything runs in your browser and nothing is sent to a server. As a habit, still avoid typing passwords for important accounts into any website: use a temporary password and change it after logging in.
Free, private developer tools that run in your browser. No signup, nothing uploaded, no waiting.
Tip: press Ctrl D to bookmark dev247.