tool

Laravel APP_KEY Generator

Generate a production-ready APP_KEY for Laravel in the base64:… format that Artisan produces. Runs entirely in your browser.

Laravel APP_KEY (base64, 32 bytes)
Identical to what php artisan key:generate produces
Key value
.env line
APP_KEY=
CLI alternative (Artisan)
Generate and write to .env
php artisan key:generate
Print only (no write)
php artisan key:generate --show

What 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

  1. Copy the generated key and add it to .env:
    APP_KEY=base64:<paste here>
  2. For production (Forge, Vapor, Railway), set the variable in the platform's environment settings — never commit it.
  3. Your .env.example should have APP_KEY= with a blank value so teammates know it is required.

Related tools