SuperDevTools

Encrypt AES 256 CBC online

Encrypt text with AES-256-CBC

AES-256-CBC is a very common combination. You find it in OpenSSL, in many web applications and in countless backup scripts. This tool encrypts text with a 256-bit key and returns the result in Base64, so you can compare it with your own code or see what each parameter does.

The server does the work with PHP's openssl_encrypt function and PKCS#7 padding.

How to use it

  1. Type the text to encrypt.
  2. Enter the key in the Salt field, which here means the key: 32 ASCII characters for 32 bytes. The password generator gives you a random 32-character key once you set its length.
  3. Enter a 16-character IV in IV (optional), or leave the field empty for a simple trial.
  4. Click Encrypt. The Base64 string appears, and the Copy button puts it on the clipboard.

256-bit key and IV: what to know

A 256-bit key takes 32 bytes and means 14 rounds per block, against 10 for AES-128. Encryption is slightly slower and the security margin is the widest of the three variants. It is the size to choose for data that must stay protected for a long time, or when a security policy asks for it.

The tool reads the key as text. A shorter key is padded with null bytes and a longer one is truncated. Be careful with a key written as 64 hexadecimal characters: it is read as 64 bytes and cut to the first 32, while a program that converts the hex to binary ends up with a completely different key. The two results will not match.

In CBC mode, each 16-byte block is combined with the previous encrypted block, and the first one with the IV. Hence the rule: a fresh random IV for every message. In PHP:

$iv = random_bytes(16);

$ciphertext = openssl_encrypt($text, 'aes-256-cbc', $key, 0, $iv);

The IV is not secret. It is usually stored in front of the ciphertext so the message can be decrypted later.

Frequently asked questions

What does the tool do if I give no IV?

It uses a fixed default IV. Encrypting the same text twice with the same key then gives the same Base64, which is fine for a test but not for real use.

Is AES-256-CBC enough to protect a message?

It protects confidentiality, not integrity. A modified ciphertext goes undetected. Well-built applications add an HMAC computed over the IV and the ciphertext, or use AES-GCM, which this tool does not offer. The site's SHA256 generator can compute an HMAC for your tests.

Can I use a password as the key?

The tool accepts it and pads it with null bytes, but the resulting key is weak. In an application, derive the key from the password with a function designed for that job, such as PBKDF2 or Argon2.

Where do my text and key go?

They are sent to the server over HTTPS, used for the calculation and not stored. Keep production secrets out of the tool all the same. To get back to plain text, the site has an decrypt AES 256 CBC page.