Bcrypt Hash Generator & Laravel APP_KEY
Locked out of your own admin panel? Make a $2y$ hash here and put it in the users table. Hashes made here pass PHP's password_verify(); we checked that against PHP itself.
FreeNo sign-upRuns in your browser: your data is not uploaded
Reset a Laravel or PHP admin password with SQL
- Type the new password above and press Generate hash.
- Open phpMyAdmin (or any MySQL client), select the database and run the
UPDATEline shown under the hash, with your real e-mail address. - Log in with the new password. Laravel's
Hash::check()reads the cost from the hash itself, so cost 10 or 12 both work.
With SSH you can do the same without this page: php artisan tinker then User::where('email','you@example.com')->update(['password' => Hash::make('new-password')]);. This page is for when you only have phpMyAdmin.
$2y$, $2a$, $2b$: what is the difference?
All three are bcrypt. PHP writes $2y$; Node.js and many other libraries write $2a$ or $2b$. For normal passwords the result is the same. This tool converts the prefix to $2y$ so PHP and Laravel accept it without surprises, and it can check hashes with any of the three prefixes.
Which cost should I use?
Each step up doubles the work. Cost 10 takes roughly 50 to 100 ms on a normal server; 12 takes four times that. Laravel 11 moved its default to 12. Higher is safer against stolen databases but slows every login, so pick the highest your server handles in about a quarter of a second.
About APP_KEY
APP_KEY encrypts cookies, sessions and anything you store with Crypt::encrypt(). It is not used for password hashes, so changing it does not lock users out, but it does log everybody out and makes previously encrypted values unreadable. Generate one for a fresh install or a leaked key; do not rotate it casually on a live site that stores encrypted data.
The error "No application encryption key has been specified" means the .env line is missing or the config cache is old. Add the line, then run php artisan config:clear (or delete bootstrap/cache/config.php if you have no SSH).
FAQ
Is it safe to type a real password here?
Why is the hash different every time?
Can I decrypt a bcrypt hash?
Does Laravel accept a hash made with cost 10 if my config says 12?
$2y$10$). Laravel may rehash it with the new cost on the next successful login if rehashing is enabled.Does this work for WordPress passwords?
$wp prefix, older versions use phpass ($P$). For WordPress, reset the password from the dashboard or with WP-CLI instead.Related guides
- Export Large Data With Chunk in Laravel-Excel: Fix
- php artisan serve: Failed to Listen on 127.0.0.1:8000 (reason: ?)
- php artisan migrate:fresh --seed Can't Seed a Table Into MySQL
- I Got "timeout-or-duplicate" Error Using reCAPTCHA v3: Fix
Link to this tool
Found it useful? Put a link in your docs, README or forum answer so others can use it too:
<a href="https://headsntail.com/tools/bcrypt-generator">Bcrypt Hash Generator & Laravel APP_KEY</a> (free, by HeadsNTail)
[Bcrypt Hash Generator & Laravel APP_KEY](https://headsntail.com/tools/bcrypt-generator)
Share: X LinkedIn Reddit WhatsApp
Need it done on your server? HeadsNTail sets up Laravel apps, cPanel hosting and migrations for businesses. See services or ask a question.