Cipher Utility

AES Encryption Explained: The Standard Behind the Web

The block cipher inside HTTPS, disk encryption and Wi-Fi.

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.

StandardFIPS 197, NIST, 2001
Original nameRijndael, by Joan Daemen and Vincent Rijmen
TypeSymmetric block cipher (one key encrypts and decrypts)
Block size128 bits (16 bytes)
Key sizes128, 192 or 256 bits
Rounds10, 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:

  1. 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.
  2. 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.
  3. 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.
  4. 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

VariantPossible keysRoundsTypical use
AES-128212810Most HTTPS connections, general use
AES-192219212Rarely used
AES-256225614Long-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 years

That 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.

ModeNotes
ECBEncrypts each block separately, so identical blocks give identical ciphertext and patterns in the data show through. Don't use it.
CBCChains blocks together. Needs a random IV and a separate MAC to detect tampering.
CTRTurns AES into a stream cipher. Needs a unique nonce and a separate MAC.
GCMEncrypts 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

CipherKey sizeBlock sizeStatus
AES128, 192, 256 bits128 bitsSecure, current standard
ChaCha20256 bitsStream cipherSecure, fast in software
3DES112 or 168 bits64 bitsWithdrawn by NIST, being phased out
Blowfish32 to 448 bits64 bitsOutdated because of its small block
DES56 bits64 bitsBroken

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