Every time you send a WhatsApp message, log in to your bank or buy something online, encryption is working quietly in the background. It is one of the most important technologies on the internet — and one of the least understood. So how does encryption work? At its core, the idea is simple: it scrambles readable information into unreadable gibberish that only the right person can unscramble. The mathematics is complex, but the concept is not.

The Lockbox Idea

Imagine you want to send a letter to a friend, but the postman might read it. So you put the letter in a lockbox and send the box. The postman can carry it but cannot read what is inside — only your friend, who has the key, can open it.

Encryption works the same way. Your readable message — plaintext — is transformed by a mathematical formula called an algorithm (or cipher) into ciphertext, a scrambled string that looks like random characters. Only someone with the right key — usually a long string of numbers generated randomly by your device — can turn it back into plaintext. The algorithm itself is public and well studied; the security comes entirely from the key. Lose the key, and the message stays locked forever.

Symmetric Encryption: One Key Opens and Locks

The oldest and fastest form is symmetric encryption: the same key locks and unlocks the data, like one key that both locks and opens a safe.

The world's standard symmetric algorithm is AES — the Advanced Encryption Standard, adopted by the US National Institute of Standards and Technology (NIST) in 2001 to replace the older DES standard. It is now used by governments, banks, messaging apps and websites everywhere.

AES works on blocks of data, taking each 128-bit chunk and transforming it many times over, mixing and rearranging the bits according to the key. The result is so thoroughly scrambled that reversing it without the key is practically impossible.

There is one problem, though: the key itself has to travel from sender to recipient. If someone intercepts the key in transit, the whole system falls apart. That problem led to the second great idea in encryption.

AES-256: What the Numbers Mean

You will often see "AES-256" in security settings. The 256 is the key length in bits: a 256-bit key has 2 to the power of 256 possible combinations — a number with 78 digits, more than the atoms in the observable universe. Trying every key would take far longer than the age of the universe.

AES-256 is approved by the US National Security Agency (NSA) for classified documents up to Top Secret level, and after more than two decades of study there is no known practical attack against it when used correctly. The modern variant AES-256-GCM adds authentication: if anyone changes even a single bit of the encrypted data, decryption fails loudly instead of silently producing corrupted output.

Asymmetric Encryption: Two Keys Instead of One

Asymmetric encryption solves the key-sharing problem with a pair of keys: a public key and a private key. Anyone can use your public key to encrypt a message to you, but only your private key — which never leaves your device — can decrypt it.

Think of it as a padlock that anyone can snap shut, but only you can open. You can hand out copies of the open padlock (your public key) to the whole world. Anyone can lock a box for you, but only you hold the key that opens it.

The best-known asymmetric algorithm is RSA, named after its inventors Rivest, Shamir and Adleman. Its security rests on a mathematical fact: multiplying two large prime numbers is easy, but working out which two primes were multiplied is extraordinarily hard. A strong RSA key (2,048 or 4,096 bits) would take today's computers an impractical amount of time to break.

Asymmetric encryption is slower than symmetric encryption, so it is rarely used on large amounts of data directly. Instead, it solves the one problem symmetric encryption cannot: getting a secret key safely to the other side.

How the Two Work Together

In practice, almost every secure connection uses both types together, in a process called hybrid encryption. When you visit a secure website — the one with the padlock icon — this is what happens:

  1. Your browser and the website use asymmetric encryption to agree on a random session key, without ever sending it in readable form.
  2. Both sides then switch to fast symmetric encryption (usually AES) for the actual data.
  3. When the session ends, the key is thrown away.

This combination is the basis of TLS, the protocol behind HTTPS — and how your messages, emails and banking sessions stay private. The padlock icon means this handshake happened, and the data travelling between you and the site is encrypted with a key nobody else holds. For more on the attacks encryption helps stop, see our guide to how passwords get hacked.

End-to-End Encryption: When Even the Company Can't Read It

There is one more level. In end-to-end encryption, your message is encrypted on your device and only decrypted on the recipient's device. It stays scrambled the whole journey, and the company running the service holds no key — even a complete breach of its servers reveals only ciphertext.

This is how WhatsApp and Signal protect messages by default. The keys exist only on the two endpoints — your phone and your friend's phone — so the server is just a courier carrying a locked box it cannot open. That is why these apps can honestly say they cannot read your messages: the mathematics makes it impossible, not just the company policy. A VPN adds a similar layer of protection for your whole internet connection — see our VPN explainer.

What Encryption Protects — and What It Doesn't

Threat Is it protected?
Someone snooping on public Wi-Fi Yes — they see only ciphertext
A hacker breaching a messaging server (with end-to-end encryption) Yes — the server holds no keys
Someone who steals your unlocked phone No — the data is already decrypted for you
A phishing email that tricks you into giving away a password No — encryption cannot check your judgement
A weak or reused password No — the key is only as strong as your login

Encryption protects data in transit and at rest. It does not protect you from someone who already has your password, your unlocked device or your trust. Encryption is essential, but it is only one layer — strong, unique passwords and two-factor authentication are the others.

What About Quantum Computers?

You may have heard that quantum computers will one day break encryption. The picture is mixed: the known quantum attack on symmetric ciphers, Grover's algorithm, roughly halves a key's effective strength — but AES-256 keeps a very large safety margin after that halving. Asymmetric encryption such as RSA is the bigger concern, because a different quantum algorithm (Shor's algorithm) could in theory factor large numbers quickly. That is why standards bodies are already developing post-quantum cryptography before the threat becomes real.

Takeaway Checklist

  • Encryption turns readable plaintext into unreadable ciphertext that only a key can unlock.
  • AES-256 is the workhorse of modern encryption: 2²⁵⁶ possible keys, approved by the NSA for Top Secret data.
  • Symmetric encryption (AES) uses one shared key — fast, but the key must be shared safely.
  • Asymmetric encryption (RSA) uses a public/private key pair — anyone can encrypt, only you can decrypt.
  • Real systems combine both: asymmetric encryption agrees a session key, symmetric encryption does the heavy lifting.
  • End-to-end encryption means even the service provider cannot read your messages.
  • Encryption protects data in transit and at rest — but it cannot save a weak password or an unlocked phone.

Hamza

Founder & Editor, TechToday

Hamza is the founder and editor of TechToday. Hamza writes about artificial intelligence, computing, security and the technology shaping everyday life, with a focus on explaining complex ideas in plain, honest language — clear answers for curious readers, without the hype.