Why This Matters

Mode choice is the most commonly misunderstood AES decision. ECB mode is still found in production systems in 2026. Choosing the wrong mode can render AES encryption completely ineffective — leaking plaintext structure, enabling bit-flip attacks, or allowing full plaintext recovery through padding oracles.

ECB: The Dangerous Default

AVOID

Electronic Codebook mode encrypts each block independently with the same key. Identical plaintext blocks produce identical ciphertext blocks, leaking the structure of the message. As defined in NIST SP 800-38A, ECB should never be used for multi-block data.

Try repeating a 16-character block, e.g. "YELLOW SUBMARINE" twice.
Upload a BMP or small PNG to see the ECB penguin effect.

Key (hex)

Ciphertext (hex)

Block Comparison

Same color = identical ciphertext block (structure leaked) Different color = different ciphertext block

Why ECB Is Never Appropriate

ECB encrypts each 16-byte block independently. This means repeated plaintext blocks always produce repeated ciphertext blocks. An attacker learns where repetition occurs — destroying confidentiality for structured data like images, database fields, or protocol messages.

Implementation note: WebCrypto does not support ECB natively. This demo implements ECB by encrypting each 16-byte block individually using AES-CBC with a zero IV, which for a single block is equivalent to ECB encryption. This approach is documented honestly — ECB is shown only to demonstrate why it must be avoided.