Skip to content

Laravel App Key Generator

Generate a random APP_KEY for a Laravel project, in the same base64-encoded 32-byte format produced by php artisan key:generate.

Category: online
Use Case: Laravel Project Setup, Encryption Key Rotation, Environment Variable Configuration
Privacy: 100% browser-based

Add this to your .env file:

APP_KEY=

Recommended Settings

Pro Tips

  • This generates 32 random bytes, base64-encodes them, and adds the base64: prefix, exactly matching the format produced by php artisan key:generate
  • Laravel uses APP_KEY to encrypt session data, cookies, and anything passed through the Crypt facade - it must be set for the framework to run securely
  • Changing your APP_KEY invalidates all existing encrypted data and sessions, including cookies and anything stored with the Crypt facade
  • Never commit your real APP_KEY to a public repository - keep it in your untracked .env file

Most Popular

Most Laravel developers run php artisan key:generate locally, but this tool is a handy browser-based equivalent

When to Use This Tool

Laravel Project Setup

Generate a fresh APP_KEY when setting up a new Laravel project without running Artisan locally.

Encryption Key Rotation

Generate a replacement key if your existing APP_KEY may have been exposed.

Environment Variable Configuration

Generate a key to add directly to your .env file or a deployment platform's secret manager.

Multi-Environment Setup

Generate distinct keys for development, staging, and production Laravel environments.

How It Works

1

Generate 32 cryptographically secure random bytes using the Web Crypto API

2

Base64-encode those bytes

3

Prefix the result with base64: to match Laravel's expected APP_KEY format

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by Web Crypto API (crypto.getRandomValues) for optimal performance on modern browsers.

Open Source

Built with verified, open-source libraries. Fully transparent.

Frequently Asked Questions

Is this the same as running php artisan key:generate?

Yes, in format and security properties. Both produce a base64: prefixed encoding of 32 cryptographically secure random bytes. This tool generates that randomness using the browser's Web Crypto API instead of PHP's random byte generator.

What happens if I change my APP_KEY on a live application?

Changing APP_KEY invalidates all data encrypted with the old key, including user sessions and anything stored via Laravel's Crypt facade. Users will be logged out and any encrypted data become unreadable.

Where should I store my APP_KEY?

Store it in your project's .env file, which should never be committed to version control. For production deployments, use your hosting platform's environment variable or secrets management feature.

Is my generated key sent to a server?

No. The key is generated entirely locally in your browser using JavaScript. It's never transmitted anywhere, including to this website's own servers.

Do I need to run this for every new Laravel project?

Yes, each Laravel project should have its own unique APP_KEY. Never reuse the same key across multiple applications.