AES-256-CBC · PKCS5 / PKCS7
AES-256-CBC encrypt and decrypt
AES-256-CBC with PKCS5 padding is still the most common setup in Java, PHP and Node code. This page opens with CBC and a 256-bit key already selected. Paste your 32-byte key and 16-byte IV, encrypt a sample and compare it with your program, or decrypt a ciphertext from logs or a database to see what’s inside.
How to use the tool
- 1
Paste the 32-byte key
AES-256 needs exactly 32 bytes: 32 characters, 64 hex digits or 44 Base64 characters. Set the format to match.
- 2
Add the 16-byte IV
Use the IV your code used. For a fresh test, press Generate to get 16 random bytes.
- 3
Keep PKCS5Padding
It equals PKCS7 and is what Java, Node and OpenSSL use by default. Choose NoPadding only if your code does.
- 4
Decrypt from your app
Paste the Base64 or Hex ciphertext on the Decrypt side with the same key and IV to read the original.
QRScanKaro
Just need to lock a message?
Text Encryption is simpler: pick a password and share the result. No keys, IVs or modes to set.
Encrypt with a password →Frequently asked questions
Why do I get “Wrong key/IV/mode or damaged text”?
In CBC with PKCS5 padding, a wrong key or mode leaves invalid padding bytes at the end, so decryption stops. Check the key and its format first, then the mode and key size. A wrong IV does not cause this error: it garbles only the first 16 bytes of the text.
How do I send the IV with the ciphertext?
The common way is to put the 16 IV bytes in front of the ciphertext and Base64 the whole thing. The receiver takes the first 16 bytes as the IV. Other systems send the IV as a separate field; either is fine because the IV isn’t secret.
Does OpenSSL’s aes-256-cbc give the same output?
Only with -K (hex key) and -iv (hex IV), for example openssl enc -aes-256-cbc -K <64 hex> -iv <32 hex> -base64. With -pass or -k, OpenSSL derives the key from a password and adds a Salted__ header, which is a different format.
Is AES-256-CBC still secure?
The cipher is fine, but CBC doesn’t detect changes, and error messages about padding have led to real attacks. If you control both sides, add an HMAC over the ciphertext or move to AES-GCM.
More free tools
Text Encryption & Decryption
Lock any message with a password using AES-256-GCM, then share it on WhatsApp or email.
RSA Encryption & Decryption
Generate RSA key pairs (2048 or 4096-bit PEM), encrypt text with a public key and decrypt with the private key.
Hash Generator
Get MD5, SHA-1, SHA-256, SHA-384 and SHA-512 of text or a file as you type.
Base64, URL & Hex Encoder
Encode and decode Base64, URL, hex, binary, HTML entities and \u escapes as you type.