What encryption is
Encryption is a way to scramble a message so only the right person can read it. If you are wondering how encryption works, it comes down to three parts.
So the plan is simple. Plaintext goes in. The algorithm mixes it with a key. Ciphertext comes out. Anyone who grabs the ciphertext sees nonsense. Only someone with the right key can turn it back into plaintext.
Think of a diary with a lock. The diary is the message. The lock is the encryption. Anyone can hold the diary, but only the person with the key can read it.
People have used this idea for about 2,000 years. Julius Caesar shifted each letter of his notes by a few places so enemies could not read them. Today your phone does the same kind of thing, but with math so strong that all the computers on Earth could not guess the key in your lifetime.
The server in the middle
When you text a friend with an app, your message does not fly straight from your phone to theirs. It goes to a server first. A server is a computer, owned by the app's company, that stays on all day and passes messages along. Then the server sends your message to your friend.
That middle step is the problem. There are three common setups:
- No encryption. The message is plaintext the whole trip. Anyone on the same public Wi-Fi, the company, and anyone who breaks into the company can read it.
- Encryption in transit. The message is locked while it travels between your phone and the server. This is what https:// and the padlock in your browser mean. People on the Wi-Fi see nonsense. But the server unlocks the message to process it, so the company can read it, and so can anyone who breaks into the server.
- End-to-end encryption (E2EE). The message is locked on your phone and only unlocked on your friend's phone. The server only ever holds ciphertext. It carries the message but cannot read it.
The "ends" in end-to-end are the two phones. The lock stays on the whole way between them. In the next section, you can watch it happen.
Follow the message
Alice is sending a message to Bob. Pick a setup, then press Next hop to move the message along. At every stop, check who could read it.
Setup
The key difference is who holds the key. With encryption in transit, the company holds a key to unlock your message at the server. With end-to-end encryption, the company never gets the key. Only the two phones have it.
Try a toy cipher
Type a message and a secret key. The cipher below shifts each character by an amount set by your key. It is the same idea as Caesar's trick, with the shift changing along with your key.
This is a toy. A smart person could crack it in minutes. Real apps use much stronger math, such as the Signal Protocol and the AES cipher, that has no known shortcut. Use this one only to see the idea: same message, different key, different ciphertext.
Toy cipher Toy. Not secure.
Change one letter of the unlock key and the message turns to junk. That is the point. The method can be public. The key is the secret.
Public and private keys
Here is a puzzle. If Alice and Bob have never met, how do they agree on a secret key? If they send the key over the internet, someone could copy it.
Apps solve this with two keys that work as a pair. This is called public-key cryptography.
- The public key locks messages. You can give it to anyone. Posting it online is fine.
- The private key unlocks messages. It never leaves your phone.
Think of a mailbox with a slot. Anyone can drop a letter in. But only you have the key to open the box and take the letters out. Or think of padlocks: you hand out thousands of open padlocks. Anyone can snap one shut on a box. Only you own the key that opens them.
Why is this safe? The two keys are linked by math that is easy to do in one direction and extremely hard to undo. Knowing the public key does not let you work out the private key. So a spy who copies Bob's public key learns nothing useful.
In a real app, your phone makes this key pair when you install it. The public key goes to the company's server so your friends can find it. The private key stays on your phone. When you message a friend, the app locks the message with their public key. Only their phone can unlock it. (Apps also use fast tricks like swapping in a fresh one-time key for each chat session, but the core idea is the same.)
What it does and does not protect
End-to-end encryption protects one thing very well: the message while it is traveling and while it sits on a server. It does not make you invisible. Here is the honest list.
It does protect
- Your message from people on the same Wi-Fi.
- Your message from the company running the app.
- Your message if hackers break into the company's servers. They only find ciphertext.
- Your message if someone demands the company hand it over. The company has nothing readable to give.
It does not protect
- A friend who screenshots it. Once your friend can read it, they can copy it, share it, or show someone.
- Someone holding your unlocked phone. The messages are readable on your screen. Use a strong passcode.
- Some backups. A chat backed up to the cloud may be stored without end-to-end encryption, depending on your settings.
- Metadata. This is data about the message, not the message. It can include who you talk to, when, how often, and from what network. Some apps collect more of it than others.
- Malware on your device. A bad app on your phone can read the screen after the message is unlocked.
- Talking to the wrong person. If a scammer pretends to be your friend, the lock works perfectly, for the scammer.
Short version: E2EE protects the road between the phones. It does not protect what happens at either end of the road.
Does this protect me?
Six situations. For each one, say whether end-to-end encryption would help. Click an answer to see why. Assume the chat app uses E2EE.
You send a private message while on the school's public Wi-Fi. A classmate runs a tool to capture network traffic. Can they read it?
You send a joke to a friend. The friend screenshots it and posts it in a group chat.
Hackers break into the app company's servers and download everything stored there. Your chats are in the stolen data. Can they read them?
Your little brother picks up your phone while it is unlocked and scrolls through your chats.
You use a messaging app with E2EE. Someone who can see the company's records learns that you messaged the same number 40 times last night. Does E2EE hide this?
Your chat app backs up your messages to the cloud, and that backup is not end-to-end encrypted. Does the backup stay private from the cloud company?
Why people argue about it
End-to-end encryption is one of the most argued-about topics in technology. Both sides have real points, so here they are fairly.
The case for keeping it
- Privacy is normal. You close the door when you talk about private things. E2EE is a door for your messages.
- It protects people at risk. Journalists, human rights workers, and people escaping abuse rely on it to stay safe.
- It limits damage from hacks. Stolen servers do not leak readable chats.
- A secret way in is a way in for everyone. Experts warn that if the company builds a hidden "backdoor" for the good guys, criminals and foreign spies can find it and use it too.
The case for limits
- Police need evidence. With a court order, police can usually ask a company for messages. With E2EE, the company has nothing readable to give.
- Harm can hide. Governments point to child safety and serious crime, where messages could help stop abuse.
- Companies cannot scan. The company cannot check chats for scams or harmful content on its own servers.
Different countries have proposed different answers, from requiring a way in, to scanning messages on the phone before they are locked, to leaving it alone. Each idea has trade-offs, and experts still disagree. Part of being a digital citizen is understanding both sides, so you can form your own view.
Which apps use it?
Is WhatsApp encrypted? Yes, and end-to-end by default. Here is how some popular choices work. Apps change, so check the app's own help page for the latest details.
| App | End-to-end by default? | Notes |
|---|---|---|
| Signal | Yes | Built around E2EE. Collects very little metadata. |
| Yes | Uses the Signal Protocol for chats and calls. Cloud backups are separate, so check the backup encryption setting. | |
| iMessage | Yes, between Apple devices | Blue bubbles are iMessage. Green bubbles are regular SMS texts, which are not end-to-end encrypted. iCloud backups have their own setting. |
| Telegram | No, only in "Secret Chats" | Normal chats are encrypted to the server, which can read them. Secret Chats are end-to-end, one-to-one only. |
| SMS text messages | No | Plain text messages are not end-to-end encrypted. |
| Social media DMs and gaming chat | Usually no | Many are encrypted in transit only. Look for an option to turn on end-to-end chats. |
How to tell for yourself
- Look for the words. Apps that do it usually say "end-to-end encrypted" in the chat or in settings.
- Check for a safety number or security code. Signal and WhatsApp let you compare a code with a friend to confirm no one is in the middle.
- Check each setting. Some apps need you to turn on E2EE chats or backups.
- Remember the padlock in your browser is not the same. That is encryption in transit to a website, not end-to-end chat.
- Read the help page. If a company will not clearly say whether it can read your messages, treat it as if it can.
Want more habits like this? See The CIA Triad, which explains why keeping data secret (confidentiality) is one of the three big goals of cybersecurity.
Quick quiz
1. An app uses encryption in transit only. Who can read your message on the server?
2. In public-key encryption, which key is safe to share with everyone?
3. Your chat app uses end-to-end encryption. Which of these is still a risk?
Keep learning
Keep going with cybersecurity
Now you know how the lock on a chat works. Learn how to build and break these ideas yourself: encryption, passwords, networks, and how real attacks happen.
Explore the CodeHS Cybersecurity course or practice in the CodeHS Cyber Range.
Part of the CodeHS cybersecurity tutorials.