Laravel APP_KEY Generator
A valid Laravel APP_KEY: 32 random bytes, base64-encoded, generated in your browser.
Local alternative
php artisan key:generatePrefer generating secrets on the machine that uses them? This command produces an equivalent value.
Official documentationLaravel encrypts sessions, cookies and everything passed through the Crypt facade with the APP_KEY. The value is base64 of exactly 32 bytes, which is why it carries the base64: prefix. Replacing the key of a running application makes already-encrypted data and existing sessions undecryptable.
Frequently asked questions
Where does the APP_KEY go?
Into the APP_KEY environment variable, usually in your project's .env file. The value carries the base64: prefix — copy it in full, Laravel decodes the part after it to exactly 32 bytes.
What happens if I replace the APP_KEY?
Anything encrypted with the old key can no longer be decrypted: existing sessions, encrypted cookies and every value stored through the Crypt facade. In a running application, replace it only deliberately and with a migration plan.
Is this the same as php artisan key:generate?
Yes, the result is equivalent: 32 random bytes in Base64. The only difference is where they are created — here in your browser, there on the machine running the command.