AES Encrypt & Decrypt
AES encryption and decryption with PBKDF2 key derivation
What is AES Encrypt & Decrypt?
This AES tool derives a 256-bit key from your passphrase with PBKDF2-SHA256 at 210,000 iterations, supports both GCM and CBC modes, and emits the random salt and IV alongside the ciphertext as JSON — so the same plaintext produces different output every time. All cryptography runs locally in the browser.
How to use AES Encrypt & Decrypt
- 1Choose encrypt or decrypt; when encrypting, pick a mode (GCM is recommended).
- 2Enter the plaintext and passphrase, then click "Encrypt".
- 3Save the entire JSON output — the salt and IV live inside it, and decryption is impossible without either.
- 4To decrypt, paste that JSON back in and supply the same passphrase.
How do I do this in code?
Use the tool above for one-off work; for anything you repeat, move it into a script or your project.
# The OpenSSL 3 equivalent: state PBKDF2 and the iteration count explicitly openssl enc -aes-256-cbc -pbkdf2 -iter 210000 -salt -in plain.txt -out cipher.bin openssl enc -d -aes-256-cbc -pbkdf2 -iter 210000 -in cipher.bin -out plain.txt
Common errors and how to fix them
| Symptom | Cause | Fix |
|---|---|---|
| Decryption fails even though the passphrase is definitely correct | The ciphertext JSON was modified, or only the data field was copied and the salt and iv were lost. | Store and paste back the complete JSON object. |
| Output is incompatible with your backend implementation | The two sides disagree on mode, IV length, or key derivation parameters. | Align all four settings: mode (GCM or CBC), IV length, KDF algorithm and iteration count, and key length. |
Frequently asked questions
Should I use AES-GCM or AES-CBC?+
Prefer GCM. It produces an authentication tag along with the ciphertext, so decryption fails outright if the data was tampered with. CBC only provides confidentiality and needs a separate HMAC to detect tampering, and hand-rolling that combination is easy to get wrong. The CBC option is here mainly for interoperating with older systems that support nothing else.
Why does encrypting the same text twice give different results?+
Because a fresh random salt and IV are generated each time, which is exactly what you want. With a fixed IV, identical plaintexts produce identical ciphertexts and an attacker can infer content from that — and in GCM, reusing an IV can leak the key itself.
Can I use this to protect genuinely sensitive data?+
It is fine for ad hoc cases, such as encrypting a snippet of configuration before attaching it to a ticket. For long-term protection use a key management service or a password manager, because a passphrase-derived key is only as strong as the passphrase, and human-chosen passphrases usually are not strong enough.
Related tools
All toolsBase64 Encoder & Decoder
Encode and decode Base64, with UTF-8 and URL-safe support
File to Base64
Convert files to Base64 and data URIs — nothing is uploaded
URL Encoder & Decoder
Percent-encode URLs, with separate modes for full URLs and parameter values
HTML Entity Encoder
Escape and unescape HTML entities
Hex to Text Converter
Convert between text and hex with several separator styles
Unicode Escape Converter
Escape and unescape Unicode in three notations