Laravel decrypt and encrypt
Runs in your browserPaste a value that starts with eyJpdiI6 or an .env.encrypted, and your APP_KEY. The MAC is checked, serialized values are unpacked. Nothing leaves your browser.
Paste the value and your APP_KEY
Values from Crypt::encryptString(), encrypt(), Laravel cookies, .env.encrypted (both formats). dotenvx and Symfony secrets work too.
Like Crypt::encryptString()
Decrypt the result with Crypt::decryptString(), or with decrypt() if “serialize” is on.
Start from an example
Each example fills in the tool above and decrypts it. All keys and passwords are demo values made for this page.
What is inside eyJpdiI6…
Laravel’s encrypter returns Base64 of a small JSON object. eyJpdiI6 is Base64 for {"iv":.
| Field | What it is |
|---|---|
| iv | 16 random bytes (CBC) or 12 (GCM), Base64 |
| value | The data, AES-256-CBC by default (config/app.php cipher), Base64 |
| mac | HMAC-SHA256 over iv and value with APP_KEY, hex (CBC only) |
| tag | GCM tag, Base64 (GCM only) |
encrypt() serializes the value first (s:6:"secret";); Crypt::encryptString() doesn’t. The tool unpacks both. Cookies carry an extra prefix (hash|value) that is removed too. Old keys from APP_PREVIOUS_KEYS are tried if you paste the whole .env.
The same in Laravel
php artisan tinker
>>> Crypt::decryptString('eyJpdiI6…')
>>> decrypt('eyJpdiI6…')php artisan env:decrypt --key=base64:… php artisan env:encrypt --readable # one encrypted value per line (Laravel 12)
php artisan key:generate --show
The MAC is invalid
Wrong APP_KEY. After key:generate or between environments (local, staging, production) values can’t be read any more. Add the old key to APP_PREVIOUS_KEYS.
The value was cut or changed, often by URL encoding (cookies: %3D). The tool decodes it first.
AES-256 needs a 32-byte key: base64: and 44 characters. A 32-character key without base64: works too.
dotenvx and Symfony secrets
dotenvx encrypts each value in .env as encrypted:… with ECIES (secp256k1 and AES-256-GCM). The public key in DOTENV_PUBLIC_KEY encrypts, the private key from .env.keys (DOTENV_PRIVATE_KEY) decrypts.
Symfony secrets live in config/secrets/<env>/, one PHP file per secret, sealed with libsodium (X25519, XSalsa20-Poly1305). Paste the file and <env>.decrypt.private.php or the value of SYMFONY_DECRYPTION_SECRET.
Tested against the original tools
Every format on this page was checked against values made by the real tool, on 3 December 2026:
- 39 values from Laravel’s Encrypter (all four ciphers, encryptString and encrypt with strings and arrays, .env.encrypted in both formats) and from Symfony’s vault format with PHP libsodium; what the tool encrypts, Laravel decrypts.
- dotenvx: a .env encrypted with @dotenvx/dotenvx; what the tool encrypts, dotenvx decrypts.
Other encrypted formats
Every format has its own page with the same tool. Paste anything into one of them: if it belongs elsewhere, the tool says so and takes it there.
Questions about Laravel
How do I decrypt a Laravel value?
Paste it above with APP_KEY from .env (base64:…). In code: Crypt::decryptString() or decrypt(), with the same key.
Why “The MAC is invalid”?
The APP_KEY doesn’t match the one that encrypted the value. Laravel checks the HMAC first and stops there.
Can I decrypt Laravel session cookies?
Yes, the cookie value (URL-encoded or not) decrypts like any other value; the hash| prefix is removed. The session data itself is on the server.
Is it safe to paste APP_KEY here?
Everything runs in your browser: nothing you paste is sent anywhere, not even to this site. The page’s Content-Security-Policy blocks connections to other sites; check the Network tab of your browser’s developer tools. APP_KEY also signs sessions and cookies: if it was ever shared, generate a new one.