AES Encryption & Decryption
Encrypt a piece of text with a password or a raw AES key, and decrypt it again later. The tool uses AES-256-GCM, which also detects any change to the encrypted text, and a documented byte layout so you can decrypt the result in your own code.
How to use this tool
- Choose Encrypt or Decrypt.
- Choose a password, or a raw key in hex or Base64 ("New random key" makes a 256-bit one).
- Type the text, or paste the encrypted Base64 to decrypt it.
- Press "Encrypt" or "Decrypt" and copy the result. Switching the mode carries the result over, so you can check a round trip.
What this tool can do
AES-256-GCM
Authenticated encryption: a wrong password or any change to the encrypted text makes decryption fail instead of returning garbage.
Password mode
The key is derived with PBKDF2-HMAC-SHA256, 600,000 iterations and a random 16-byte salt, as OWASP recommends for this function. The output is Base64 of salt, 12-byte IV, ciphertext and 16-byte tag.
Raw key mode
Use your own 128, 192 or 256-bit key in hex or Base64. The output is Base64 of the 12-byte IV, ciphertext and tag, the layout most libraries use.
Private
Text, passwords and keys stay in your browser. Nothing is sent to a server.
Tips and common problems
Decryption fails
The password or key must be exactly the same, including case and spaces, and the mode (password or raw key) must match the one used to encrypt.
Every encryption gives a different result
That is correct. Each run uses a new random IV (and salt), so the same text never encrypts to the same output. All of them decrypt to the original.
Decrypting in my own code
Split the Base64-decoded bytes: password mode is salt[0:16], IV[16:28], tag in the last 16 bytes; raw key mode is IV[0:12] and the tag in the last 16 bytes. Use AES-GCM from your language's crypto library.
Frequently asked questions
Which AES mode does this use?
AES-GCM with a 256-bit key (or the length of your raw key), a 96-bit random IV and a 128-bit authentication tag.
Is my text or password sent anywhere?
No. Encryption and decryption run in your browser with the Web Crypto API.
Can I decrypt the result with OpenSSL?
The openssl enc command does not support GCM. Use a few lines of code in Python, Node.js, Go or Java with the layout shown under the tool.
How strong is the password mode?
As strong as the password. PBKDF2 slows down guessing, but a short or common password can still be found, so use a long random passphrase.
More developer tools
Secret Key Generator
Random secrets in hex, Base64 or Base64URL, API keys and passwords, with the entropy shown.
Open tool →Hash Generator
MD5, SHA-1, SHA-256, SHA-384 and SHA-512 of text or files, HMAC, and checksum comparison.
Open tool →Base64 Encode & Decode
Text and files to Base64 or Base64URL, data URIs, and Base64 back to text, hex or a file.
Open tool →