Categories
AES Encryption / Decryption
Encrypt and decrypt text with AES (CBC, GCM, CTR) using your own key and IV, or with a passphrase.
Overview
Encrypts and decrypts text with AES. You can choose how to specify the key: "Key and IV" or "Passphrase".
With "Key and IV", you specify the algorithm (AES-CBC, AES-GCM, AES-CTR), the key (16 bytes for AES-128, 32 bytes for AES-256), and the IV (initialization vector). Useful for decrypting data encrypted by other systems such as Java, PHP, Node.js, or OpenSSL, and for checking the output of your own implementation.
With "Passphrase", a key is derived from the passphrase using PBKDF2 (100,000 iterations) and the text is encrypted with AES-256-GCM. A random salt and IV are generated on every encryption, and the salt, IV, and encrypted data are output together as a single Base64 string in this tool's own format.
Usage
- 1
Select "Encrypt" or "Decrypt" as the mode, and enter the plain text or ciphertext.
- 2
Choose the key input. To exchange data with other systems, choose "Key and IV" and enter the algorithm, key format, ciphertext format, key, and IV ("Generate random IV" is available when encrypting).
- 3
If you choose "Passphrase", enter a passphrase.
- 4
Click the "Encrypt" or "Decrypt" button to see the result.
Example
Input
Plain text: Hello, World! / AES-CBC / Key (hex): 2b7e151628aed2a6abf7158809cf4f3c / IV: 000102030405060708090a0b0c0d0e0f
Output
Ciphertext (hex): 73591223788e116d0593254421262658
Use Cases
Decrypting data encrypted by Java, PHP, Node.js, etc. with its key and IV to check its contents
Checking whether the AES encryption in your application produces the correct ciphertext for the same key and IV
Encrypting text lightly with a passphrase before sharing it with someone else
Learning about and verifying how AES-GCM encryption and decryption work
FAQ
Can I still decrypt if I forget the passphrase?
No. The passphrase is never stored anywhere, so there is no way to decrypt the ciphertext if you forget it.
Does encrypting the same text twice produce the same ciphertext?
No. A random salt and IV are generated on every encryption, so the same plain text and passphrase produce a different ciphertext each time. This is expected behavior.
Is the text or passphrase I enter sent anywhere?
No. Encryption and decryption happen entirely in your browser using the Web Crypto API. The key, IV, and passphrase are never stored.
What padding is used?
AES-CBC uses PKCS#7 padding (same result as Java's PKCS5Padding). AES-GCM and AES-CTR do not use padding.
Where is the AES-GCM authentication tag?
Ciphertext is input and output with the 16-byte authentication tag appended to the end, the same format as Java and OpenSSL. If your library handles the tag separately (as Node.js does), append the tag to the ciphertext before entering it.
Are AES-192 and ECB mode supported?
No. AES-192 is not supported by the Web Crypto API in Chrome. ECB is not supported because identical plaintext blocks produce identical ciphertext blocks, making it insecure, and the Web Crypto API does not provide it.
Notes
We do not recommend using the ciphertext or passphrase generated by this tool for long-term storage of real sensitive information.
Ciphertext from the passphrase mode is in this tool's own format. To exchange data with other systems, use "Key and IV".
Reusing the same IV with the same key severely weakens AES-GCM and AES-CTR. Use "Generate random IV" to get a new IV for every encryption.
The AES-CTR counter treats the whole 16-byte IV as one number and increments it by 1 (the same as OpenSSL and Java).
Related Tools
Generate SHA-1, SHA-256, SHA-384, and SHA-512 hash values from text.
Generate an RSA public/private key pair in PEM format.