SuperDevTools

Decrypt AES 128 ECB online

Decrypt AES-128-ECB text online

This page decrypts Base64-encoded text that was encrypted with AES-128-ECB. All it needs is the ciphertext and the key, because ECB mode has no IV. To produce such a message from plain text, go through the encrypt AES 128 ECB page.

You still run into ECB in older applications, in MySQL's AES_ENCRYPT function, in some device protocols and in cryptography exercises. The tool lets you read such a value quickly during a test or a debugging session.

How to decrypt AES-128-ECB text

  1. Paste the Base64-encoded ciphertext into the text area.
  2. Type the key into the Salt field (despite the label, it is the key): 16 characters for AES-128.
  3. Click Decrypt. There is no IV field because ECB does not use one.
  4. The plaintext appears, and the Copy button puts it on your clipboard.

A key that is too short is padded with null bytes; one that is too long is cut to 16 bytes. The work is done on the server with OpenSSL: text and key are sent over HTTPS and are not stored. To be on the safe side, do not paste production secrets.

ECB mode and the 128-bit key

In ECB (Electronic Codebook), the message is split into 16-byte blocks and each block is encrypted on its own with the same key. As a result, two identical plaintext blocks give two identical ciphertext blocks. Encrypt 32 letters "A": the output is 48 bytes (two data blocks plus one padding block), or 64 Base64 characters, and when you print it as hex the first 32 characters are repeated right after.

That regularity exposes the structure of the data, which is why ECB is discouraged for anything sensitive even though it survives in existing systems. An AES-128 key is 16 bytes, or 16 plain characters.

Decryption fails or returns nothing: common causes

On failure, the result box shows false or error instead of text. Things to check:

  • Wrong key: it must match character for character (case, a stray space or line break).
  • Wrong mode: the message was actually encrypted in CBC, with an IV.
  • Wrong key size: an AES-256-ECB message will not decrypt here. Send it to the decrypt AES 256 ECB page instead; a CBC message with an IV goes to decrypt AES 128 CBC.
  • Input that is not Base64: hex ciphertext, URL-safe Base64 with - and _, or a message cut short while copying.
  • Key in hex: the tool reads the characters as typed and does not convert them to bytes.
  • Password-derived key: CryptoJS with a passphrase or openssl enc -pbkdf2 compute the key from a password and a salt. Such messages start with U2FsdGVkX1, and the tool does not handle that derivation.

The equivalent OpenSSL command

openssl enc -d -aes-128-ecb -a -A -K KEY_HEX -in message.txt

KEY_HEX is the key written in hex (32 characters for 16 bytes), and -a -A tells OpenSSL the input is single-line Base64. ECB takes no -iv option.

Frequently asked questions

Why is there no IV field?

ECB does not chain blocks, so nothing depends on a starting value. If the sender gave you an IV, their message is probably CBC.

Can I read a value encrypted by MySQL?

In the common case, yes: AES_ENCRYPT uses AES-128-ECB by default. Its output is binary, so export it with TO_BASE64(). A key shorter than 16 characters is padded with null bytes there, as it is here.

Is ECB secure?

AES itself is sound, but ECB reveals repetitions and does not stop blocks from being reordered. For a new project, pick a mode with an IV.