AES (Advanced Encryption Standard) is the symmetric cipher standardised by NIST in FIPS 197: it encrypts data in 128-bit blocks with a secret key of 128, 192 or 256 bits, and the same key decrypts it. Used correctly, in an authenticated mode such as AES-GCM and with a strong, secret key, it is the cipher you should reach for when data needs encrypting; NIST re-examined it in 2023 and kept the specification unchanged.
AES at a glance
| Variant | Key length | Block size | Rounds | Security strength (NIST) |
|---|---|---|---|---|
| AES-128 | 128 bits | 128 bits | 10 | 128 bits |
| AES-192 | 192 bits | 128 bits | 12 | 192 bits |
| AES-256 | 256 bits | 128 bits | 14 | 256 bits |
The rounds come from FIPS 197, Table 3; the strengths from NIST SP 800-57 Part 1. The block size is always 128 bits; only the key length and the number of rounds change. AES is the Rijndael cipher: NIST announced Rijndael as the winner of the AES competition in 2000 and published FIPS 197 on November 26, 2001. A 2023 review updated the document's presentation but kept the technical specification unchanged.
How AES works
AES treats each 16-byte block as a 4 × 4 grid of bytes called the state. First the key is expanded into a series of round keys. Then each round applies four transformations, named in FIPS 197:
- SubBytes: every byte is replaced using a fixed substitution table (the S-box). This is the non-linear step; without it, AES would be a set of equations that could be solved directly.
- ShiftRows: the bytes in rows 1, 2 and 3 of the grid are rotated left by 1, 2 and 3 positions. Row 0 stays put.
- MixColumns: each column is multiplied by a fixed matrix, so every output byte depends on all four input bytes of that column.
- AddRoundKey: the round key is combined with the state using XOR. This is the only step that uses the key.
ShiftRows moves bytes between columns and MixColumns mixes bytes within each column. Repeated over 10 to 14 rounds, with a different round key each time, this spreads the influence of every plaintext and key bit across the whole block. The last round skips MixColumns. Decryption runs inverse versions of the steps in reverse order with the same round keys.
Verify AES yourself with a known test vector
A test vector is a fixed key, plaintext and expected ciphertext. If an implementation reproduces it, it is computing real AES. This is the AES-128 example from Appendix C.1 of the original 2001 edition of FIPS 197 (the 2023 edition points to NIST's website for example values instead), run with OpenSSL in Git Bash on Windows or a Linux or macOS terminal:
printf '00112233445566778899aabbccddeeff' | xxd -r -p \
| openssl enc -aes-128-ecb -nopad -K 000102030405060708090a0b0c0d0e0f \
| xxd -p
Output:
69c4e0d86a7b0430d8cdb78070b4c55a
The AES-256 example (Appendix C.3) uses the key 000102...1e1f (32 bytes counting up) and the same plaintext:
printf '00112233445566778899aabbccddeeff' | xxd -r -p \
| openssl enc -aes-256-ecb -nopad -K 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f \
| xxd -p
8ea2b7ca516745bfeafc49904b496089
Both outputs were produced with OpenSSL 3.2.1. ECB is used here only because it encrypts exactly one block with no extra inputs, which is what a test vector needs. Don't use it for real data, for the reason below.
Why the mode matters more than the key length
AES on its own encrypts one 16-byte block. To encrypt anything longer you need a mode of operation, and choosing the wrong one is a far more common failure than choosing a short key. NIST SP 800-38A defines the classic modes (ECB, CBC, CFB, OFB, CTR) and SP 800-38D defines GCM.
ECB encrypts each block independently, so identical plaintext blocks produce identical ciphertext blocks. Encrypt ATTACK AT DAWN!! twice in a row (two identical 16-byte blocks) with the test key above:
printf 'ATTACK AT DAWN!!ATTACK AT DAWN!!' \
| openssl enc -aes-128-ecb -nopad -K 000102030405060708090a0b0c0d0e0f | xxd -p -c16
8a21cef935d8587bea999da471a91c41
8a21cef935d8587bea999da471a91c41
Anyone looking at the ciphertext can see the message repeats, without knowing the key. The same text in CBC mode with an IV gives two unrelated blocks (fd75d96e... and 3bdbf3a3...). That leak is why ECB is unsuitable for real data.
| Mode | Hides patterns | Detects tampering | Use it? |
|---|---|---|---|
| ECB | No | No | No, except single-block test vectors |
| CBC | Yes, with a random IV | No (needs a separate MAC) | Legacy systems |
| CTR | Yes, with a unique counter | No (needs a separate MAC) | As a building block |
| GCM | Yes, with a unique IV | Yes (authentication tag) | Yes, the usual default |
GCM is authenticated encryption: alongside the ciphertext it produces a tag, and decryption fails if a single bit was changed. Its one sharp edge is the IV (nonce). SP 800-38D requires that the probability of ever using the same IV twice with the same key be no greater than 2-32, and its Appendix A explains why: if an IV repeats under one key, an attacker can likely recover the hash subkey and forge ciphertexts that decrypt to any plaintext of the same length. Use a fresh random 96-bit IV for every message, or a counter that never repeats. Never hard-code one.
Turning a password into an AES key
An AES key is a random 128- or 256-bit value, not a password. When a person types a password, a password-based key derivation function stretches it into a key; NIST SP 800-132 covers deriving keys from passwords with a salt and an iteration count. The salt makes each derived key unique, and the iteration count makes every password guess slow for an attacker.
As a concrete example, larely's text encryption tool uses AES-256-GCM with a key derived by PBKDF2-SHA-256 at 310,000 iterations, a random 16-byte salt and a fresh 12-byte IV for every encryption, all in the browser, and documents the byte layout so the output can be decrypted elsewhere. Even so, the result is only as strong as the password: AES-256 does not help if the password is summer2026. See password entropy explained for what makes a password hard to guess.
Where AES fits with other cryptography
AES is symmetric, so both sides need the same key. Protocols such as HTTPS solve that with an asymmetric key exchange and then switch to an AEAD cipher such as AES-GCM for the data. The symmetric vs asymmetric encryption guide explains how the two fit together and why AES-128 is stronger than a 2048-bit RSA key despite the smaller number.
Frequently asked questions
- Has AES been cracked?
- Not in any way that matters in practice. NIST reviewed the standard, including public analyses of its security, and in its May 2023 update of FIPS 197 kept the technical specification unchanged. Real-world breaks come from how AES is used: weak passwords, leaked keys, reused GCM nonces or insecure modes such as ECB.
- Is AES-128 enough, or do I need AES-256?
- NIST's key-management guidance rates AES-128 at a 128-bit security strength, AES-192 at 192 and AES-256 at 256. The same guidance (Table 4) lists 128, 192 and 256 bits as acceptable for protecting new data through 2030 and from 2031 onwards, so AES-128 is enough for most purposes. AES-256 gives a larger margin at the cost of 14 rounds instead of 10.
- Is AES symmetric or asymmetric?
- Symmetric. The same key encrypts and decrypts. That is why AES is usually paired with an asymmetric key exchange, as in HTTPS, or with a password-based key derivation function when a person types a password.
- What is the difference between AES and RSA?
- AES is a fast symmetric block cipher used to encrypt the data itself. RSA is a slower asymmetric algorithm used for key exchange and signatures. Most secure protocols use both: RSA or elliptic-curve cryptography to set up a key, then AES to encrypt the traffic.
Sources
- NIST FIPS 197 (2023 update): Advanced Encryption Standard (AES)
- NIST FIPS 197 (original 2001 edition, withdrawn; Appendix C example vectors)
- NIST SP 800-38A: Block cipher modes of operation (ECB, CBC, CFB, OFB, CTR)
- NIST SP 800-38D: Galois/Counter Mode (GCM) and GMAC
- NIST SP 800-132: Recommendation for Password-Based Key Derivation
- NIST SP 800-57 Part 1 Rev. 5: Recommendation for Key Management