Skip to main content

Use arrow keys to navigate, Enter to select, Escape to close menu.

AES-256: The Cipher, the Mode, and the Limits

AES-256 names a cipher, not a promise. The mode you run it in, the nonce you feed it, and the passphrase behind your key decide what it can really protect.

A Cipher Is Not a Security Level

256 names a key length

AES-256 is a block cipher with a 256-bit key, standardized in FIPS 197. It turns a fixed block of data into ciphertext under a key. The number 256 describes key length. It says nothing about your files, your device, or the person holding the key.

Two other choices matter as much as key size. The mode of operation decides how the cipher handles data longer than one block. Key derivation decides how your passphrase becomes a key. AES-256-GCM is one combination. AES-256-CBC is another. They share the cipher and differ almost everywhere else.

Try it: find out which mode the tool you use runs.

  • AES-256: the cipher and its 256-bit key
  • Mode of operation: how blocks are chained or authenticated
  • Key derivation: how a passphrase becomes a key

GCM and CBC Use the Same Block Cipher

Authentication is the dividing line

CBC chains each block to the previous one, which hides patterns in the plaintext. On its own it does not detect tampering. Someone who flips ciphertext bits can cause predictable damage without knowing the key. GCM adds an authentication tag over the ciphertext, described in NIST SP 800-38D. A modified file then fails to decrypt instead of yielding wrong data.

There is a second difference in what you may reuse. CBC needs a fresh random initialization vector per message. GCM needs a nonce that never repeats under the same key. Reusing a GCM nonce is one of the few mistakes that breaks the design outright, which is why libraries generate it for you and seldom expose the choice.

Try it: check whether your tool notices a modified file.

  • CBC hides patterns but does not detect edits
  • GCM adds an authentication tag over the ciphertext
  • GCM nonces must never repeat under one key

What AES-256 Does Not Protect

Four gaps the cipher cannot close

Key length says nothing about how the key was created. A key derived from a short or reused passphrase is as weak as the passphrase, whatever the cipher does. PBKDF2, described in RFC 8018, and similar functions slow guessing down. They cannot rescue a password that anyone can look up.

Encryption also says nothing about the endpoints. Malware on the device, a browser extension with page access, or a script injected into the page sees your plaintext before any cipher runs. Some metadata survives as well: file sizes, timestamps, and the fact that a transfer happened usually stay visible.

Try it: name the gap that applies to your setup.

  • Weak or reused passphrases stay weak
  • A compromised endpoint sees plaintext first
  • File name, size, and timing can stay visible

Where Browser Encryption Changes the Picture

The runtime around the cipher

The Web Crypto API runs AES-256-GCM inside the browser and can hold a key as non-exportable. Script cannot read those raw key bytes back out. The page still has to receive your passphrase, though, and anything running in that page can read what you type. The origin you load therefore matters more than the mode you pick.

A non-exportable key helps in one narrow case. If someone copies storage or a memory dump later, a key that was never exportable is harder to lift. It does nothing against code running in the page while you type, and it does not survive a device that is already compromised.

Try it: create a non-exportable key and try to read it back.

  • Web Crypto can hold a non-exportable key
  • The page receives your passphrase in plaintext
  • One new script on the origin defeats every layer

Choosing What Fits Your Case

Two questions sort most situations

Ask what you are defending against first. A lost laptop, a shared upload folder, and a provider that logs everything call for different designs. Then ask who has to decrypt. If only you hold the key, a client-side tool using AES-256-GCM and a long passphrase covers most of the risk. If someone else must read the data later, key exchange becomes the hard part.

One practical rule: prefer a tool that authenticates. Without a tag, a corrupted or edited file may decrypt into wrong data, and nothing in the output warns you. That failure is quiet, which is exactly why it is worth designing out.

Try it: answer both questions for one file you need to protect.

  • Name the threat before choosing a mode
  • Prefer authenticated encryption over bare CBC
  • Decide up front who holds the key
SituationBetter fit
Files you encrypt and store yourselfAES-256-GCM with a passphrase you control
A legacy system that only accepts CBCAES-256-CBC plus a separate integrity check
Cases where a wrong key must fail loudlyAuthenticated encryption such as AES-GCM

Frequently Asked Questions

Is AES-256-CBC weaker than AES-256-GCM?

The cipher is the same. The difference is authentication: GCM adds a tag that detects modification, while plain CBC does not. CBC can still be a reasonable choice, but it needs a separate integrity check on top. Padding errors in CBC have also been used in real attacks, so the mode deserves more care than it usually gets.

Does a 256-bit key make a file impossible to break?

It means the key space is 2^256, which no known attack searches directly. Breaking a file in practice means attacking the key instead: guessing a weak passphrase, recovering it from a device, or exploiting a mistake in the implementation. Key length is the part that rarely fails.

Which mode should I pick if I am not sure?

Pick an authenticated mode such as AES-256-GCM, and use a passphrase long enough to be worth the derivation cost. If a system you must talk to only supports CBC, add an integrity check rather than trusting the ciphertext alone. In a browser, the Web Crypto API gives you GCM and a non-exportable key without extra work.

Try AES-256-GCM in Your Browser

Encrypt text or files with a key derived on your device. Nothing is uploaded, and the key stays with you.