On this page
- What is encryption, and how does it work?
- Types of encryption: symmetric vs asymmetric
- How HTTPS uses both types of encryption
- Encryption in transit vs encryption at rest
- End-to-end encryption vs VPN encryption
- Encryption algorithms you’ll see named
- Is “military-grade encryption” a real thing?
- What encryption can’t protect
- Quantum computing and the future of encryption
- The bottom line
- Frequently asked questions
Key takeaways
- Encryption uses an algorithm and a key to turn readable data into scrambled ciphertext that only the right key can turn back.
- Symmetric encryption uses one shared key and is fast; asymmetric encryption uses a public and private key pair and solves key sharing.
- HTTPS uses both: public-key cryptography to agree on a session key, then fast symmetric encryption for the data itself.
- A VPN encrypts traffic between your device and the VPN server; end-to-end encryption protects a message all the way to the recipient.
- Encryption can’t protect a hacked device, stop phishing or make up for a weak password, and it often leaves metadata visible.
Every time you sign in to an app, pay online or send a message, encryption is working in the background. It’s also one of the most overused words in tech marketing, often paired with phrases like “military-grade” that sound impressive and explain very little.
So, what is encryption? It’s a way of scrambling information so that only someone with the right key can read it. Readable data, called plaintext, goes in, and unreadable data, called ciphertext, comes out.
This guide covers how encryption works, the main types, how your browser and a VPN use them, and what encryption can’t protect.
What is encryption, and how does it work?
Picture a lockbox. You put a letter inside, lock it and send it off. Anyone handling the box can see it, weigh it and shake it, but nobody can read the letter without the key.
Digital encryption has three ingredients:
- Plaintext: the readable original, such as a message, a photo or a password.
- An algorithm, or cipher: the method that does the scrambling, like the design of the lock.
- A key: a very long random number the algorithm uses to lock and unlock the data.
Feed plaintext and a key into the algorithm and you get ciphertext, which looks like random noise. Decryption reverses the process for anyone holding the right key.
The lock’s design isn’t the secret. Good algorithms are published so experts worldwide can try to break them, following a long-standing rule called Kerckhoffs’s principle: a system should stay secure even if everything about it except the key is public.
Why key length matters
Keys are measured in bits, and each extra bit doubles the number of possible keys. A 128-bit key has a 39-digit number of possibilities, and a 256-bit key has a 78-digit number. Trying them all, called a brute-force attack, isn’t realistic with any computer that exists today.
Length only compares like with like, though. Public-key algorithms, covered next, use different math: an RSA key needs 2,048 bits or more to be considered safe today, while an elliptic-curve key of about 256 bits offers similar or better protection.
Types of encryption: symmetric vs asymmetric
Most real systems combine two types of encryption.
Symmetric encryption uses one key to lock and unlock. It’s a lockbox with two identical keys: fast and simple, but you have to get the second key to the other person without anyone copying it on the way.
Asymmetric encryption, also called public-key cryptography, uses a matched pair of keys. Imagine handing out open padlocks: anyone can snap one shut on a box meant for you, but only you hold the key that opens them. The padlock is your public key, which you can share freely; the key is your private key, which never leaves your device. Key pairs also enable digital signatures, which prove a message or website really comes from whoever holds the private key.
| Symmetric | Asymmetric | |
|---|---|---|
| Keys | One shared secret key | A public key and a private key |
| Speed | Very fast, even for large files | Much slower |
| Typical job | Encrypting the data itself | Agreeing on keys, proving identity, signing |
| Weak spot | Sharing the key safely | Too slow for bulk data |
| Examples | AES, ChaCha20 | RSA, elliptic-curve cryptography |
Each covers the other’s weakness, which is why secure websites use both.
How HTTPS uses both types of encryption
Your browser and an HTTPS site start with no shared key, on a network anyone might be watching. Here’s a simplified version of the TLS handshake (TLS is the security protocol behind HTTPS), which fixes that in a fraction of a second:
- Hello. Your browser contacts the site and lists the encryption methods it supports.
- Proof of identity. The site sends its certificate, which contains its public key and is vouched for by a certificate authority your browser trusts, and proves it holds the matching private key.
- Key agreement. Using public-key math, often an elliptic-curve method called X25519, both sides arrive at the same fresh secret without ever sending it across the network.
- Switch to symmetric. Both sides turn that secret into session keys and encrypt everything else, every page, image and password, with a fast symmetric cipher such as AES or ChaCha20-Poly1305.
In lockbox terms, the slow padlock step happens once to set up a shared key, then the fast lockbox does the rest. Modern HTTPS also uses throwaway keys for each connection, so stealing a site’s private key later won’t unlock traffic recorded earlier, a property called forward secrecy.
Encryption in transit vs encryption at rest
Data needs protecting in two states:
- In transit: moving across a network, like a page loading or a message sending. HTTPS, encrypted messaging and VPNs protect data in transit.
- At rest: sitting in storage on a laptop, phone, backup drive or company server. Full-disk encryption, such as BitLocker or Device Encryption on Windows, FileVault on a Mac and the built-in encryption on modern phones, protects data at rest.
You want both. Encryption in transit doesn’t help if a company stores your data unencrypted and then gets breached. Disk encryption protects a stolen laptop that’s switched off, but once you’ve unlocked it, your files are readable to you, and to any malware running on it.
End-to-end encryption vs VPN encryption
End-to-end encryption (E2EE) means a message is encrypted on your device and can only be decrypted on the recipient’s device. The service carrying it never has the key, so it can’t read your messages. In lockbox terms, only your friend has the key, and the courier just carries a locked box. Many popular messaging apps now use end-to-end encryption for chats by default.
A VPN works differently. It encrypts traffic between your device and the VPN server, forming a tunnel through your Wi-Fi network and internet provider, and it uses the same recipe as HTTPS: public-key cryptography to set up keys, then fast symmetric encryption for the data. At the VPN server, that outer lockbox is opened, and your traffic continues to the website protected only by the site’s own encryption, which today is usually HTTPS.
So the two aren’t competitors:
- A VPN hides your traffic from the local network and your internet provider, and hides your IP address from websites. You’re trusting the VPN provider instead, which can see what HTTPS doesn’t hide.
- End-to-end encryption protects specific messages or calls all the way to the other person, whatever network you’re on.
For more on the tunnel, see what a VPN is and how it works.
Encryption algorithms you’ll see named
Here’s what the acronyms on settings screens and product pages mean:
- AES (Advanced Encryption Standard): the most widely used symmetric cipher. NIST, the US National Institute of Standards and Technology, standardized it in 2001 after an open public competition. It comes in 128-, 192- and 256-bit versions and protects everything from Wi-Fi networks to phone storage. Many processors have built-in hardware to run it fast.
- ChaCha20-Poly1305: a modern symmetric pairing in which ChaCha20 encrypts the data and Poly1305 detects tampering. It’s very fast in software, which helps on devices without AES hardware, and it’s a standard option in modern HTTPS and the cipher WireGuard uses.
- RSA: one of the first public-key algorithms, dating to the late 1970s and named after its inventors, Rivest, Shamir and Adleman. Its security rests on how hard it is to factor huge numbers, and it’s still common in website certificates.
- Elliptic-curve cryptography (ECC): public-key cryptography based on the math of elliptic curves, offering RSA-level strength with far smaller keys. Curve25519 is a popular, well-studied curve; its key-agreement form, X25519, secures a large share of HTTPS connections and is built into WireGuard.
For how these choices play out in VPNs, see our WireGuard vs OpenVPN comparison, and for other jargon, our VPN glossary.
Is “military-grade encryption” a real thing?
Not as a technical term. “Military-grade encryption” is a marketing phrase, usually describing AES with a 256-bit key. AES-256 is excellent, and the US government has approved it for protecting classified information, which is what the phrase leans on. But it isn’t exotic: AES is a public standard built into everyday laptops, phones and websites.
When a product leans on the phrase, ask better questions. Which protocol does it use? Is it a well-known, openly published design? A careful implementation of a modern protocol matters far more than an adjective, and AES-128 and ChaCha20 are also considered extremely strong, even though nobody markets them as military-grade.
What encryption can’t protect
Encryption protects data in a specific place against a specific kind of snooping. It can’t help with:
- A hacked device. Malware sees your data before it’s encrypted and after it’s decrypted.
- Metadata. Encryption usually hides what you said, not who you talked to, when, from where or how much data moved, and those patterns can reveal a lot.
- Phishing. A password typed into a fake login page travels to the scammer over a perfectly encrypted connection.
- Weak passwords. Many systems protect their keys with your password or passcode, so a short or reused one undermines even strong encryption.
- The other end. Unless a service uses end-to-end encryption, the company receiving your data can read it.
For more everyday habits, see our online privacy tips that actually make a difference.
Quantum computing and the future of encryption
A large, reliable quantum computer could break the public-key algorithms behind most key exchanges and digital signatures today, including RSA and elliptic-curve cryptography. No such machine is known to exist, and experts disagree about when one might. Symmetric encryption such as AES-256 is expected to hold up well.
The worry is “harvest now, decrypt later”: someone could record encrypted traffic today and unlock it once quantum computers mature. In August 2024, NIST published its first post-quantum cryptography standards, FIPS 203, 204 and 205, one for agreeing on keys and two for digital signatures. The industry is adopting them gradually, often alongside today’s algorithms in a hybrid setup, and some major browsers and messaging apps already use post-quantum key exchange.
The bottom line
Encryption turns your data into ciphertext that only the right key can unlock. Symmetric encryption does the heavy lifting, asymmetric encryption solves key sharing, and HTTPS, messaging apps and VPNs combine the two. It keeps your passwords and payments private, but it can’t fix a compromised device, a phishing page or a weak password.
A VPN adds one more encrypted layer, between your device and the VPN server, which is especially useful given the real risks of public Wi-Fi. OqusFreeVPN is built on WireGuard and is 100% free with no ads, and you can see how its encrypted tunnel works.
Frequently asked questions
Private browsing, 100% free
OqusFreeVPN encrypts your connection in one tap. No account, no credit card, no ads.
Written by the OqusFreeVPN Team
We build OqusFreeVPN, the 100% free VPN — no ads, no credit card, no premium tier. Our guides explain online privacy in plain English, including the limits of what any VPN can do.
Why OqusFreeVPN is free