All Tools

AES Encrypt and Decrypt Online, OpenSSL Compatible

Encrypt text with AES-128, AES-192 or AES-256 in GCM, CBC, CTR, CFB or ECB mode, using a passphrase compatible with openssl enc -pbkdf2 or a raw key and IV. Runs in your browser; nothing is uploaded.

Direction
Ciphertext format
Cipher
Key type

Key and IV are derived with PBKDF2-HMAC-SHA256 (10,000 iterations), as openssl enc -pbkdf2 does.

0 characters, 0 bytes

0 characters, 0 bytes


About AES encryption

This page encrypts and decrypts text with AES, the Advanced Encryption Standard (FIPS 197), in your browser. AES is a 128-bit block cipher with 128-, 192- or 256-bit keys, and it protects almost everything today: HTTPS, disk encryption, Wi-Fi, password managers and messaging apps. Type text, give a passphrase or a raw key, and the ciphertext appears at once in Base64 or hex. Passphrase output is compatible with openssl enc -pbkdf2, so it decrypts on any machine with OpenSSL. Nothing is uploaded; your text and keys never leave your device.

How to encrypt with AES

Steps

  1. Encrypt and AES are already selected. Choose the Key size (256 bits by default) and the Mode.
  2. Type a passphrase, or choose Key and IV and enter a 16-, 24- or 32-byte key in hex or as text. Generate key and Generate IV fill in random values.
  3. Type or paste the text. Copy the ciphertext with Copy.
  4. To decrypt, choose Decrypt and paste the ciphertext, or press Swap to reverse what you just encrypted.

Privacy

AES runs in the page, on your device. Your text, passphrase and keys are never sent to a server and are forgotten when you close the tab.

Choosing a mode

GCM: the recommended mode

GCM (NIST SP 800-38D) encrypts and authenticates in one pass. The 16-byte tag is appended to the ciphertext, and decryption refuses anything that was changed, so a tampered message cannot be passed off as genuine. It needs a 12-byte nonce that must never repeat under the same key. Use GCM for new work.

CBC, CTR and CFB: for compatibility

CBC with PKCS#7 padding is what most OpenSSL scripts, PHP openssl_encrypt calls and older Java code use, which is why this page opens on it. CTR and CFB turn AES into a stream cipher with no padding. All three hide the text but do not detect changes; pair them with a MAC if you design a protocol, or better, use GCM.

ECB: avoid

ECB encrypts each 16-byte block on its own, so identical blocks of text give identical ciphertext and patterns show through. It needs no IV and is offered only to match existing systems and test vectors.

Decrypting with OpenSSL

With a passphrase, the output is Salted__, an 8-byte random salt and the ciphertext, with key and IV derived by PBKDF2-HMAC-SHA256 over 10,000 iterations. Save the Base64 output as message.b64 and run:

openssl enc -d -aes-256-cbc -pbkdf2 -base64 -A -in message.b64 -pass pass:YOUR-PASSPHRASE

Change -aes-256-cbc to match the key size and mode you chose, such as -aes-128-ctr or -aes-192-cfb. To encrypt on the command line for this page to decrypt, run openssl enc -aes-256-cbc -pbkdf2 -base64 -A -pass pass:YOUR-PASSPHRASE and paste the result. OpenSSL's enc command does not support GCM, so use a raw key and nonce, or a library, for GCM interoperability.

Raw key and IV

AES picks its size from the key: 16 bytes is AES-128, 24 is AES-192 and 32 is AES-256. CBC and CFB need a 16-byte IV, CTR a 16-byte initial counter block and GCM a 12-byte nonce. Keys and IVs can be typed as hex or as UTF-8 text; a key of the wrong length is reported with the lengths AES accepts. A random IV or nonce should be generated for every message and sent alongside the ciphertext; it does not need to be secret.

Related tools

The full Encryption Tool adds DES, Triple DES, Speck, RC4 and XXTEA for legacy systems. Make a strong passphrase with the Password Generator, check data integrity with the Hash Generator, and convert ciphertext between encodings with the Base64 Encoder or Text to Hex.

Open-source credits

  • AES and its ECB, CBC, CTR, CFB and GCM modes come from @noble/ciphers by Paul Miller, MIT licence.
  • PBKDF2 and the random salts, keys and IVs come from the browser's built-in Web Cryptography API.

Other related tools