AES Encryption and Decryption
NewEncrypt and decrypt text or files with AES-256, locally in your browser. Choose GCM or CBC mode, enter a password or a raw 256-bit key, and encrypt text to Base64 or a file to a downloadable .enc file. Your data, passwords and keys never leave your device.
The password is turned into a key with PBKDF2-SHA256 (600,000 iterations) and a random salt.
Drag and drop a file here or click to select
How to encrypt text with AES
- Select Encrypt.
- Keep AES-256-GCM unless another system requires CBC.
- Enter a password, or choose Raw 256-bit key and enter or generate a key.
- Type or paste the text and select Encrypt.
- The encrypted text appears as Base64 and is copied to your clipboard.
Encrypting the same text twice gives a different result each time, because every encryption uses a new random salt and IV. Both results decrypt to the same text.
How to decrypt AES-encrypted text
- Select Decrypt.
- Choose the same mode and key type that were used to encrypt.
- Enter the same password or key.
- Paste the Base64 text and select Decrypt.
If the password, key, mode or key type is wrong, decryption fails with an error instead of showing garbled text. With GCM, decryption also fails if the encrypted text was changed. If the decrypted data is not text, the tool offers it as a file to download.
Encrypting and decrypting files
Drop a file into the file area, or select it, then choose Encrypt or Decrypt. Encrypting report.pdf produces report.pdf.enc to download; decrypting report.pdf.enc gives back report.pdf. Files are processed in your browser's memory, so very large files may be slow or fail.
AES-256-GCM vs. AES-256-CBC
| Feature | AES-256-GCM | AES-256-CBC |
|---|---|---|
| Confidentiality | Yes | Yes |
| Detects changed or corrupted data | Yes, with a 16-byte authentication tag | No |
| IV size | 12 bytes | 16 bytes |
| Padding | None | PKCS#7 |
| Recommended use | Default choice for new data | Compatibility with systems that require CBC |
Use GCM by default. CBC hides the data but cannot tell whether it was modified, so an attacker may be able to change encrypted data without being noticed. Systems that use CBC securely add a separate integrity check, such as an HMAC.
How the password becomes a key
AES-256 needs a 32-byte key, not a password. In Password mode, the tool derives the key with PBKDF2-HMAC-SHA256 using 600,000 iterations and a random 16-byte salt, following the OWASP recommendation for PBKDF2. The many iterations make each password guess slow, which protects weak passwords somewhat, but a long, unique password is still the best protection.
In Raw 256-bit key mode, the key is used directly. Enter it as 64 hex characters or as Base64, or select Generate random key to create one with the browser's secure random number generator.
Encrypted data format
The encrypted text is Base64 of these bytes, and an encrypted file contains the same bytes:
| Key type | Layout |
|---|---|
| Password | salt (16 bytes) + IV + ciphertext |
| Raw key | IV + ciphertext |
The IV is 12 bytes for GCM and 16 bytes for CBC. For GCM, the last 16 bytes of the ciphertext are the authentication tag. The mode and key type are not stored, so you need to know them to decrypt.
Decrypt in Python
This example decrypts password-mode AES-256-GCM text with the cryptography package:
import base64
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
data = base64.b64decode(encrypted_text)
salt, iv, ciphertext = data[:16], data[16:28], data[28:]
key = PBKDF2HMAC(algorithm=hashes.SHA256(), length=32, salt=salt, iterations=600_000).derive(password.encode())
print(AESGCM(key).decrypt(iv, ciphertext, None).decode())
Decrypt in Node.js
const crypto = require('crypto');
const data = Buffer.from(encryptedText, 'base64');
const salt = data.subarray(0, 16);
const iv = data.subarray(16, 28);
const tag = data.subarray(data.length - 16);
const ciphertext = data.subarray(28, data.length - 16);
const key = crypto.pbkdf2Sync(password, salt, 600000, 32, 'sha256');
const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);
decipher.setAuthTag(tag);
console.log(Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString('utf8'));
For a raw key, skip the salt and PBKDF2 steps: the IV starts at the first byte, and the key is your 32-byte key. For CBC, the IV is 16 bytes, there is no tag, and the cipher is aes-256-cbc.
Security considerations
- Your data stays on your device. Encryption and decryption use the Web Crypto API in your browser. Nothing you enter is sent to a server.
- Lost passwords and keys cannot be recovered. There is no reset or backdoor, so store them in a password manager.
- Share the password or key separately. Sending the encrypted text and its password in the same message defeats the purpose.
- Use a strong password. PBKDF2 slows down guessing but cannot make a short or reused password safe.
- This tool is not a replacement for audited software. For long-term storage of sensitive files, consider established tools such as age, GnuPG or VeraCrypt. This tool does not use OpenSSL's
encformat, so its output cannot be decrypted withopenssl enc.
Frequently asked questions
Is my data uploaded to a server?
No. Encryption and decryption run in your browser with the Web Crypto API. Your text, files, passwords and keys are never sent anywhere or saved.
Why does encrypting the same text give a different result each time?
Each encryption uses a new random salt and IV, which are stored in the output. This hides whether two messages are the same. Every result still decrypts to the original text with the right password or key.
Which mode should I use, GCM or CBC?
Use AES-256-GCM. It also detects whether the encrypted data was changed. Choose CBC only when another system requires it.
Can I decrypt the output with OpenSSL or another tool?
Yes, with code that reads the documented format, such as the Python and Node.js examples on this page. The output is not in OpenSSL's enc format, so openssl enc -d cannot decrypt it directly.
What happens if I forget the password?
The data cannot be recovered. AES-256 has no known practical attack, and the tool keeps no copy of your password or key.
Related tools
- Password generator — Create a strong password for encryption.
- HMAC generator — Add an integrity check to data, for example alongside AES-CBC.
- SHA-256 hash calculator — Calculate a checksum of a file before and after encryption.
- Base64 encoder and decoder — Encode and decode Base64 text.
Further reading
- NIST SP 800-38D — Galois/Counter Mode (GCM)
- RFC 8018 — PKCS #5: Password-Based Cryptography (PBKDF2)
- OWASP Password Storage Cheat Sheet — PBKDF2 iterations
Last updated: