AES Encryption Explained: The Cipher That Guards the Web

AES encryption explained in plain terms starts with a scramble. The Advanced Encryption Standard, or AES, is the cipher that turns readable data into unreadable cipher text, and back again, using a secret key. The central question is how a single published algorithm can protect everything from messaging apps to government archives, and the answer is mathematics plus scrutiny: AES has survived twenty-five years of attack by the world’s best cryptographers without a practical break.

AES is a symmetric cipher, which means the same key encrypts and decrypts. It works on blocks of 128 bits, runs through a series of rounds that substitute, shift, and mix the data, and comes in three key sizes: 128, 192, and 256 bits. The longer the key, the more rounds, and the harder the cipher is to break by brute force.

It is the default almost everywhere you look: in the TLS that protects your browsing, in the disk encryption on your laptop, in messaging apps, and in Wi-Fi. This article explains how AES works, how it should be used, and where people still get it wrong.

Key takeaways

  • AES is a symmetric block cipher with 128, 192, and 256-bit keys.
  • It scrambles data through repeated rounds of substitution, shifting, and mixing.
  • AES-256 is the standard choice for data that must stay secret for decades.
  • The mode of operation matters as much as the cipher; ECB mode must be avoided.
  • AES is fast in hardware and trusted by governments, banks, and messaging apps.

What AES is

AES began as a competition. In 1997, the United States National Institute of Standards and Technology asked the world for a replacement for the ageing DES cipher, and in 2000 it chose Rijndael, designed by two Belgian cryptographers, Joan Daemen and Vincent Rijmen. It became a federal standard in 2001, and then, unusually, the standard of everyone else too.

The cipher is a substitution-permutation network. Each block of data is arranged as a four-by-four grid of bytes, and each round passes the grid through four steps: substitute each byte using a fixed table, shift the rows, mix the columns, and add the round key. Ten rounds for a 128-bit key, twelve for 192, and fourteen for 256, and then the grid that comes out is the cipher text.

Every step has a purpose. Substitution breaks simple patterns, shifting and mixing spread each byte’s influence across the block, and adding the key ties the result to the secret. After enough rounds, the relationship between the plain text, the key, and the cipher text is so tangled that no shortcut is known, and the only attack is trying every key.

How AES is used in practice

AES never works alone. A cipher needs a mode of operation, which decides how blocks are combined, and the mode decides whether the result is secure. The old ECB mode encrypts each block separately, which leaks patterns: encrypt a picture with ECB and you can still see the picture, which is a famous demonstration of the failure.

Modern modes fix this. CBC chains each block to the one before it, so identical blocks encrypt differently, but it needs care with padding and integrity. GCM, the current favourite, adds authentication, so it detects tampering as well as hiding the data, and it runs fast in parallel, which is why TLS 1.3 uses it almost exclusively.

Key management is the other half of the job. AES is only as strong as its key, and a key must be random, long enough, and stored safely, ideally in a hardware module or a key management service. Our guide to end-to-end encryption explains how AES is used inside messaging apps, and our guide to TLS explains its role in protecting web traffic.

Key sizes and how safe they are

A 128-bit key has about 340 undecillion possible values, and trying them all is beyond any computer that exists or is plausibly coming. A 256-bit key squares that impossibility, and it is the choice for data that must stay secret for decades, because it also resists the theoretical speed-up a quantum computer could offer against symmetric ciphers.

That quantum point deserves care. A large quantum computer could, in theory, halve the effective strength of a symmetric key, turning AES-128 into the equivalent of a 64-bit key, which is weak, while AES-256 would still offer 128 bits of strength, which is strong. This is why long-lived secrets are moving to 256-bit keys today, long before any quantum computer exists that can run the attack.

For most purposes, AES-128 is perfectly safe, and AES-256 is chosen for margin and for compliance. The difference in speed is small, since modern processors have dedicated AES instructions, and the difference in safety is mostly about the far future rather than today.

The honest summary is that the key size is rarely the weak point. Attackers do not break AES; they steal keys, exploit bad modes, or attack the software around the cipher. Getting the mode, the key storage, and the random number generation right matters far more than choosing between 128 and 256 bits.

Close-up photograph of hands typing on a backlit keyboard, a monitor glowing with a grid pattern in the background
Close-up photograph of hands typing on a backlit keyboard, a monitor glowing with a grid pattern in the background, showing the block-by-block scrambling at the heart of AES.

Comparing AES with other ciphers

AES is not the only symmetric cipher, though it is the most used. ChaCha20 is the leading alternative, designed to be fast in software without special hardware, and it is the cipher TLS falls back to on devices without AES instructions. Older ciphers such as DES and 3DES are retired, and RC4 is broken outright.

Asymmetric ciphers such as RSA play a different role: they are slow, and they are used to exchange keys and sign data, not to encrypt bulk traffic. In a TLS connection, RSA or elliptic-curve cryptography agrees the session key, and AES then encrypts the data, each doing the job it is good at.

The table below compares the main options.

Aspect AES ChaCha20 3DES RSA
Type Symmetric block cipher Symmetric stream cipher Symmetric block cipher Asymmetric cipher
Speed Very fast in hardware Very fast in software Slow Slow
Best for Bulk encryption Mobile and software Legacy systems only Key exchange, signing
Status today The standard Modern alternative Retired Key exchange only
Quantum risk Low with 256-bit keys Low with 256-bit keys High Broken in theory

The practical result is that AES is the default, ChaCha20 is the fallback for software-only devices, and everything else in the table is either a specialist or a relic. New systems should use AES-GCM or ChaCha20-Poly1305 and nothing older.

Where AES is used

TLS uses AES to encrypt web traffic, and since most of the web is now encrypted, AES is arguably the most executed algorithm on the planet. Every page load, every API call, and every login negotiates a session key and then hands the bulk encryption to AES-GCM.

Disk encryption uses AES to protect laptops and phones. BitLocker, FileVault, and Android’s file encryption all use AES, so a stolen device yields cipher text rather than files, and the key is protected by your password or a hardware chip.

Messaging apps use AES inside their end-to-end encryption, and Wi-Fi uses it in WPA2 and WPA3, so the traffic between your laptop and your router is scrambled too. Governments use it for classified data, and the fact that the United States trusts AES-256 with its own top-secret material is the strongest endorsement a cipher can have.

Even password managers rely on it. Your vault is an AES-encrypted file, and your master password derives the key, which is why a strong master password matters so much, and why our guide to homomorphic encryption describes a different frontier, where computation happens on data that stays encrypted throughout.

Common mistakes and how to avoid them

The most common mistake is ECB mode, which encrypts each block separately and leaks patterns. It is the default in some old tutorials and some careless libraries, and it must never be used for real data. Use GCM, which authenticates as well as encrypts.

The second mistake is reusing an initialisation vector, the random value that makes each encryption different. Reuse it with GCM and the security collapses entirely, revealing both the key stream and the authentication key. The vector must be random, unique for every encryption under the same key, and never repeated.

The third is encrypting without authenticating. Encryption hides data, but it does not detect tampering, and an attacker who can flip bits in cipher text can change the plain text in predictable ways. Always use an authenticated mode, or add a separate message authentication code, and verify it before decrypting.

The fourth is weak key generation. A key derived from a short password, or generated with a poor random number source, is the real vulnerability in most systems. Use a proper random generator for keys, and a proper key derivation function for passwords.

AES encryption checklist

  • Use AES-256-GCM for new systems, or ChaCha20-Poly1305 where hardware support is missing.
  • Never use ECB mode for any real data, under any circumstances.
  • Generate a fresh random initialisation vector for every encryption.
  • Always authenticate encrypted data and verify before decrypting.
  • Generate keys from a proper random source, never from a short password.
  • Store keys in a hardware module or key service, not in code or files.
  • Rotate keys on a schedule and plan for what happens when one leaks.
  • Use a vetted library and never implement AES yourself.
  • Test the failure paths, including tampered cipher text and missing keys.

Frequently asked questions

What is AES encryption?

It is a symmetric cipher that turns readable data into cipher text using a secret key, and it is the standard encryption algorithm used across the web, devices, and government systems.

Is AES-128 or AES-256 better?

AES-256 has a larger safety margin, especially against future quantum attacks, and costs almost nothing extra in speed. AES-128 is safe today, but 256 is the better choice for data that must stay secret for decades.

Has AES ever been broken?

No practical break exists. There are academic attacks that shave a few bits off the theoretical strength, but none that threatens real use, and the cipher has survived twenty-five years of scrutiny.

What is the difference between AES and RSA?

AES is symmetric and fast, used for bulk data, while RSA is asymmetric and slow, used to exchange keys and sign data. Real systems use both, each for the job it suits.

Why is ECB mode bad?

It encrypts each block separately, so identical blocks produce identical cipher text, and patterns in the data leak through. A picture encrypted with ECB is still recognisable, which defeats the purpose.

Is AES safe against quantum computers?

With 256-bit keys, yes, for practical purposes. A quantum computer could halve the effective key size, but AES-256 would still offer 128 bits of strength, which remains secure.

The bottom line

AES encryption explained in one line is this: a well-scrutinised cipher, used in an authenticated mode, with a random key, keeps data secret.

The cipher itself is the easy part. The discipline around it, the mode, the vectors, the keys, and the authentication, is where real security is won or lost.

This article is general information about how AES encryption works, not advice about securing a particular system.

Latest articles

Scroll to Top