No application encryption key has been specified - Rocketeers app

  [ Rocketeers ](/)   

[Login](https://rocketeersapp.com/login) 

 On this page

 Knowledge
---------

No application encryption key has been specified
================================================

### [\#Laravel](https://rocketeersapp.com/knowledge/laravel)

This Laravel error appears when the APP\_KEY is missing. It is one of the first things you hit after cloning a project. The fix is a single artisan command.

 Published by [Mark van Eijk](https://rocketeersapp.com/author/mark-van-eijk) on June 23, 2026 · 1 minute read

1. [About the error](#content-about-the-error)
2. [Why do I see this error](#content-why-do-i-see-this-error)
3. [Solution](#content-solution)
4. [On a server](#content-on-a-server)

[\#](#content-about-the-error "Permalink")About the error
---------------------------------------------------------

The full message is:

 ```
RuntimeException: No application encryption key has been specified.

```

Laravel uses the `APP_KEY` to encrypt cookies, sessions and anything you pass through the `Crypt` facade. Without it, the framework refuses to boot rather than fall back to no encryption.

[\#](#content-why-do-i-see-this-error "Permalink")Why do I see this error
-------------------------------------------------------------------------

The `APP_KEY` value in your `.env` is empty or missing. This almost always happens right after:

- Cloning a project from Git, the `.env` is gitignored, so you start without a key.
- Copying `.env.example` to `.env` without generating a fresh key.

[\#](#content-solution "Permalink")Solution
-------------------------------------------

Generate a key. Laravel writes it straight into your `.env` for you:

 ```
php artisan key:generate

```

If you don't have a `.env` file yet, create one first:

 ```
cp .env.example .env
php artisan key:generate

```

After generating, your `.env` will contain a value like:

 ```
APP_KEY=base64:Rk9wq3y...=

```

With debug off, a missing key reaches visitors as a generic [500 Internal Server Error](/500-internal-server-error-laravel), so this is worth checking first on a fresh deploy.

If you cached your config, clear it so the new key is picked up:

 ```
php artisan config:clear

```

### [\#](#content-on-a-server "Permalink")On a server

If you see this in production, the deploy likely doesn't have an `APP_KEY` set. Generate one **once** and keep it stable, changing it later invalidates every existing session and encrypted cookie, logging all your users out and making old encrypted data unreadable.

For a non-interactive deploy you can write the key without the confirmation prompt:

 ```
php artisan key:generate --force

```

See [environment variables in Laravel](/environment-variables-laravel) for more on how `.env` values are loaded.

### Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

  Fill in your email address to receive updates  Subscribe 

#### More in [\#Laravel](https://rocketeersapp.com/knowledge/laravel)

- [How to use different PHP versions with Laravel Valet](https://rocketeersapp.com/knowledge/different-php-versions-laravel-valet)
- [Disable cookies in Laravel](https://rocketeersapp.com/knowledge/disable-cookies-in-laravel)
- [Logging in Laravel](https://rocketeersapp.com/knowledge/laravel-logging)
- [How to check which Laravel version of your app is using](https://rocketeersapp.com/knowledge/check-laravel-version)
- [Disable CSRF in Laravel](https://rocketeersapp.com/knowledge/disable-csrf-in-laravel)
- [Creating an encrypted cookie value in Laravel](https://rocketeersapp.com/knowledge/creating-an-encrypted-cookie-value-in-laravel)

 [View all 19 articles →](https://rocketeersapp.com/knowledge/laravel)
