Encrypt and decrypt text in your browser using AES-128, AES-192, or AES-256 with CBC, CTR, or GCM modes. Enter a custom key and IV for full control.
The AES Encrypt & Decrypt tool lets you perform symmetric encryption and decryption entirely within your browser using the Web Crypto API — the same battle-tested cryptographic primitive used by TLS, full-disk encryption, and secure messaging apps. Select a key length (128, 192, or 256 bits), an operation mode (CBC for compatibility, CTR for streaming, or GCM for authenticated encryption), then supply your own hex-encoded key and IV or generate them randomly. Ciphertext is output as base64 for easy transport, and authenticated GCM mode also exposes the authentication tag so you can detect tampering. No data is ever sent to a server.
QWhich AES mode should I use?
Use AES-GCM whenever possible. It provides both confidentiality and integrity — the authentication tag detects any modification to the ciphertext. AES-CBC is widely supported but requires a separate MAC (e.g., HMAC) to achieve authenticated encryption. AES-CTR turns AES into a stream cipher and is efficient but also lacks built-in authentication.
QWhat is an IV and why does it matter?
The Initialisation Vector (IV) is a random value that ensures identical plaintexts produce different ciphertexts each time. In CBC and CTR modes the IV must be 16 bytes (128 bits); in GCM mode it is typically 12 bytes (96 bits). Never reuse an IV with the same key — particularly in CTR and GCM modes, IV reuse is catastrophic and can expose the key stream or allow forgery.
QHow do I choose the right key size?
AES-256 offers the highest security margin and is recommended for sensitive data. AES-128 is still considered secure against classical attacks and is slightly faster. AES-192 is rarely used and offers a negligible practical advantage over AES-128. For most applications AES-256 is the right default.
QIs the output base64 or hex?
Ciphertext is encoded as base64 by default, which is compact and safe to include in JSON, URLs, or email. The key and IV are expressed as hex strings because they are binary values that benefit from explicit byte-level readability during debugging.
QCan I decrypt ciphertext produced by OpenSSL?
Yes, provided you use the same key, IV, and mode. Note that `openssl enc -aes-256-cbc` derives the key and IV from a password using EVP_BytesToKey with MD5, which is not the same as supplying a raw key. Use the raw key/IV flags (`-K` and `-iv`) in OpenSSL to match this tool's behaviour.
QWhy does GCM decryption fail with 'authentication error'?
GCM decryption verifies the authentication tag before returning plaintext. Any modification to the ciphertext, tag, or associated data will cause this error. Ensure the ciphertext and tag bytes are exactly what was produced during encryption and have not been truncated or modified.