Overview
AES, the Advanced Encryption Standard, is the symmetric cipher behind most of the encryption you use every day: HTTPS connections, Wi-Fi, phone and laptop disk encryption, VPNs and messaging apps. It was published by the US National Institute of Standards and Technology (NIST) in 2001, and after more than twenty years of public analysis there is still no practical attack on the full cipher.
| Standard | FIPS 197, NIST, 2001 |
|---|---|
| Original name | Rijndael, by Joan Daemen and Vincent Rijmen |
| Type | Symmetric block cipher (one key encrypts and decrypts) |
| Block size | 128 bits (16 bytes) |
| Key sizes | 128, 192 or 256 bits |
| Rounds | 10, 12 or 14, depending on key size |
Why AES replaced DES
Before AES, the standard was DES, the Data Encryption Standard from the 1970s. Its 56-bit key became too short as computers got faster. In 1999 the Electronic Frontier Foundation's purpose-built machine, working with the distributed.net volunteer network, found a DES key in about 22 hours.
NIST ran an open competition for a replacement from 1997 to 2000. Fifteen candidate algorithms from around the world were submitted and judged on security, speed on many kinds of hardware, and how easy they were to implement. The winner was Rijndael, designed by the Belgian cryptographers Joan Daemen and Vincent Rijmen. It ran well on everything from smart cards to large servers.
How AES works
AES encrypts one 16-byte block at a time. It arranges the block as a 4 × 4 grid of bytes, called the state, and runs it through a series of rounds. Each round applies four steps:
- SubBytes replaces each byte with another from a fixed lookup table, the S-box. For example, byte 0x19 becomes 0xd4. This step is non-linear, which defeats attacks that rely on simple equations between input and output.
- ShiftRows shifts the second row of the grid one place to the left, the third row two places and the fourth row three places, so bytes from one column spread into others.
- MixColumns combines the four bytes of each column using arithmetic in a finite field, so every output byte depends on every input byte of the column.
- AddRoundKey combines the state with a round key, derived from the main key, using XOR. This is the step where the secret key enters.
After a few rounds, changing one bit of the input or the key changes about half of the output bits. AES-128 uses 10 rounds, AES-192 uses 12 and AES-256 uses 14. The final round skips MixColumns. Decryption runs the inverse steps in reverse order with the same key.
In the language of cryptography, SubBytes provides confusion (hiding the relationship between key and ciphertext) and ShiftRows and MixColumns provide diffusion (spreading each input bit across the output). A design built from repeated substitution and permutation layers like this is called a substitution-permutation network.
AES-128, AES-192 and AES-256
| Variant | Possible keys | Rounds | Typical use |
|---|---|---|---|
| AES-128 | 2128 | 10 | Most HTTPS connections, general use |
| AES-192 | 2192 | 12 | Rarely used |
| AES-256 | 2256 | 14 | Long-term data, government use, extra margin against quantum attacks |
AES-128 is already far beyond brute force. AES-256 does about 40% more work per block because of its extra rounds, which on modern hardware rarely matters. The US National Security Agency approves AES-256 for TOP SECRET information.
How long brute force would take
Suppose a billion computers each test a billion keys per second. That is 1018 keys per second. On average you would have to try half of all AES-128 keys, 2127, before finding the right one:
2^127 keys ÷ 10^18 keys per second ≈ 1.7 × 10^20 seconds
≈ 5.4 × 10^12 yearsThat is about 400 times the age of the universe, which is roughly 1.4 × 1010 years.
Known attacks
- Biclique attack (2011). The best known attack on the full cipher reduces AES-128 from 2128 to about 2126.1 operations. That is still nowhere near practical.
- Related-key attacks. These work on AES-256 in theory, but only if the attacker can get data encrypted under several keys with a chosen mathematical relationship. Properly generated random keys never have one.
- Side-channel attacks. These measure timing, power use or electromagnetic leaks of a particular implementation rather than attacking the algorithm. Constant-time code and hardware AES instructions defend against them.
Quantum computers
Grover's algorithm would let a large quantum computer search keys in roughly the square root of the usual time, which halves the effective key length: AES-128 would offer about 64 bits of security, AES-192 about 96 and AES-256 about 128. In practice Grover's algorithm is hard to run in parallel, and no quantum computer today is anywhere near large enough. Quantum computers are a much bigger threat to public key systems such as RSA. NIST's post-quantum standards, first published in 2024, replace those public key algorithms; AES stays, with AES-256 recommended where long-term protection matters.
Where AES is used
- HTTPS: most TLS connections encrypt page data with AES-GCM. See How HTTPS works.
- Wi-Fi: WPA2 and WPA3 encrypt wireless traffic with AES.
- Storage: BitLocker, FileVault and the built-in encryption on iPhones and Android phones use AES.
- VPNs: IPsec, OpenVPN and many commercial VPNs use AES.
- Messaging: the Signal protocol, used by Signal and WhatsApp, encrypts message content with AES.
- Compressed archives: ZIP and 7-Zip can encrypt with AES-256.
Hardware support
Intel processors have had dedicated AES instructions (AES-NI) since 2010 and AMD since 2011. ARMv8 processors, which include most smartphones, have similar instructions. With them a single core can encrypt more than a gigabyte per second, and the instructions run in constant time, which also helps against timing attacks.
Using AES correctly
AES on its own encrypts exactly one 16-byte block. To encrypt real data you need a mode of operation, and most AES failures in practice come from choosing or using the mode badly.
| Mode | Notes |
|---|---|
| ECB | Encrypts each block separately, so identical blocks give identical ciphertext and patterns in the data show through. Don't use it. |
| CBC | Chains blocks together. Needs a random IV and a separate MAC to detect tampering. |
| CTR | Turns AES into a stream cipher. Needs a unique nonce and a separate MAC. |
| GCM | Encrypts and authenticates in one step. The usual choice today, as long as a nonce is never reused with the same key. |
- Generate keys and IVs with a cryptographically secure random number generator.
- Never reuse a nonce with the same key in GCM or CTR mode; doing so can reveal the plain text.
- When the key comes from a password, derive it with Argon2, scrypt or PBKDF2, never by hashing the password once.
- Keep keys out of source code. Use a key management service or a hardware security module for important keys.
- Use a tested library instead of writing AES yourself.
AES compared with other ciphers
| Cipher | Key size | Block size | Status |
|---|---|---|---|
| AES | 128, 192, 256 bits | 128 bits | Secure, current standard |
| ChaCha20 | 256 bits | Stream cipher | Secure, fast in software |
| 3DES | 112 or 168 bits | 64 bits | Withdrawn by NIST, being phased out |
| Blowfish | 32 to 448 bits | 64 bits | Outdated because of its small block |
| DES | 56 bits | 64 bits | Broken |
ChaCha20-Poly1305 is the main alternative. It is fast and constant time in plain software, so TLS often uses it on devices without AES hardware instructions, such as older phones. For very small devices, NIST picked the lightweight Ascon family in 2023. For everything else, AES remains the default, and the main thing to get right is how you use it. Choosing the right encryption covers where AES fits next to hashing and public key methods.
Further reading
- Symmetric vs Asymmetric Encryption: The Difference One shared key or a key pair, and why HTTPS uses both.
- Choosing the Right Encryption for Your Needs Match the tool to the job: data at rest, data in transit, passwords.
- How HTTPS Works: TLS, Certificates and Encryption What the padlock in the address bar actually checks.