AES guide / Key material

AES Key, IV, and Nonce Sizes Explained

AES interoperability fails most often because the key, IV, nonce, or text encoding does not match. These values have different jobs and should be handled differently.

Try it locally

Use the AES workspace to test documented values in your browser. Do not paste long-lived production secrets into a tool unless you understand and accept your device and browser risks.

Open the AES tool

AES key lengths

AES-128 requires exactly 16 bytes, AES-192 requires 24 bytes, and AES-256 requires 32 bytes. A text string is not automatically the same as a byte sequence: a non-ASCII character can take more than one UTF-8 byte. Hex uses two characters per byte, while Base64 uses a compact text representation of binary data.

IVs and nonces

AES-CBC requires the exact 16-byte initialization vector used when encrypting. AES-GCM uses a 12-byte nonce in this tool. These values are normally stored or transmitted alongside ciphertext, but a nonce must be unique for each use of a key.

Do not use passwords directly

A memorable password is usually not a correctly sized random AES key. A production system should derive a key with a reviewed password-based key-derivation function and store the salt and parameters needed to repeat that derivation.

Quick checklist

  1. Confirm whether the values are literal UTF-8 text, Hex, or Base64.
  2. Select the matching format before pasting a key, IV, or nonce.
  3. Match exact byte length before attempting encryption or decryption.

Common questions

Can I use the same IV twice?

For CBC, use an unpredictable IV. For GCM, never reuse a nonce with the same key.

Is Base64 a form of encryption?

No. It is only a way to represent bytes as text.