Laravel APP_KEY Generator
Generate a production-ready APP_KEY for Laravel in the base64:… format that Artisan produces. Runs entirely in your browser.
APP_KEY=php artisan key:generatephp artisan key:generate --showWhat is the Laravel APP_KEY?
Laravel uses APP_KEY to encrypt cookies, signed URLs, queued job payloads, and anything passed through Laravel's encryption/decryption layer. It is a 32-byte key encoded as base64:<value>.
Without a valid APP_KEY, Laravel throws a RuntimeException: No application encryption key has been specifiedand refuses to start. The key must be set before any data is encrypted — changing it in production invalidates all existing encrypted values.
Format — why base64: prefix?
Laravel's Encrypter class reads the prefix to know the key is base64-encoded, then decodes it before use. The raw key must be exactly 32 bytes for AES-256-CBC (the default cipher) or 16 bytes for AES-128-CBC. This tool always generates a 32-byte key for AES-256.
How to set it up
- Copy the generated key and add it to
.env:APP_KEY=base64:<paste here> - For production (Forge, Vapor, Railway), set the variable in the platform's environment settings — never commit it.
- Your
.env.exampleshould haveAPP_KEY=with a blank value so teammates know it is required.
Related tools
- Laravel .env Generator — full scaffold for a Laravel project
- Secret Generator — general-purpose secrets for any stack
- ENV Leak Checker — scan for accidentally exposed secrets