How HTTPS Actually Works: TLS, Certificates, and the Little Lock Icon
What the browser lock icon really means: the TLS handshake, certificates, and common HTTPS myths — explained simply.
You type a password into a website and a little lock appears in the address bar. Most people read that as "this site is safe." That's roughly half right. The lock means your connection is encrypted and you're (probably) talking to who you think you're talking to. It says nothing about whether the site itself is honest. Understanding the difference starts with understanding what HTTPS actually does.
The problem HTTPS solves
When you visit a plain http:// site, everything travels as readable text: the page you requested, the password you typed, the cookie that keeps you logged in. Anyone on the network path — a nosy café Wi-Fi operator, a compromised router, an ISP — can read or even modify it. HTTPS fixes three things at once:
- Eavesdropping: nobody in the middle can read the traffic.
- Tampering: nobody in the middle can silently modify it.
- Impersonation: you can verify the server is really who it claims to be.
The "S" stands for Secure, and the machinery behind it is called TLS (Transport Layer Security). SSL is its ancient ancestor — the name stuck around, but nobody should be running SSL anymore.
Two kinds of locks: symmetric vs asymmetric encryption
TLS uses two different kinds of encryption, because each is good at something the other isn't.
Symmetric encryption uses one shared secret key to both lock and unlock data — like a single physical key that opens the same padlock from both sides. Algorithms like AES-256-GCM and ChaCha20-Poly1305 are blazingly fast, which is why they do the heavy lifting of encrypting your actual browsing traffic. The catch: both sides need the same key, and agreeing on that key over an insecure channel is the hard part.
Asymmetric encryption uses a key *pair*: a public key you can share with the world, and a private key you never share. Data locked with the public key can only be unlocked with the private key. It's elegant — but roughly a thousand times slower than symmetric encryption, so it's useless for streaming megabytes of web pages.
The trick TLS pulls off: use the slow-but-clever asymmetric math only for a split second to agree on a fast symmetric key, then switch to symmetric encryption for everything else.
Certificates: who vouches for whom
Here's the remaining hole: if a stranger hands you a public key and says "I'm your bank," how do you know it's really your bank's key? Enter certificates and certificate authorities (CAs).
A certificate is a small digital document that binds a public key to a domain name (like example.com), signed by a CA. Your browser and operating system ship with a list of around a hundred root CAs they trust. Trust flows down a chain:
- The website presents its leaf certificate (for its domain).
- That certificate was signed by an intermediate CA.
- The intermediate was signed by a root CA your device already trusts.
Your browser verifies each signature up the chain, checks the certificate hasn't expired, and checks the domain name matches. If any link breaks, you get the scary full-page warning — and you should take it seriously.
The TLS 1.3 handshake, step by step
TLS 1.3 (the current version, in wide use since 2018) slimmed the handshake down to a single round trip. Simplified, it goes like this:
1. ClientHello — your browser says hello and, cleverly, *guesses* the server's preferred key-exchange method, sending its public key share up front along with the cipher suites it supports. 2. ServerHello — the server picks a cipher suite and sends back its own key share. At this point both sides can independently compute the same shared secret using Diffie-Hellman math — an eavesdropper who saw both public shares still can't compute it. 3. Everything after this is encrypted. The server sends its certificate plus a signature proving it owns the certificate's private key. Your browser verifies the chain described above. 4. Finished — both sides exchange integrity checks, and from here on every HTTP request and response travels inside symmetric encryption.
Two things worth knowing about TLS 1.3 specifically: it made forward secrecy mandatory (even if a server's private key is stolen later, previously recorded traffic can't be decrypted), and it removed the old RSA key exchange that lacked that property. It also moved the certificate *inside* the encrypted channel — in TLS 1.2, the certificate was sent in the clear.
You can watch this happen yourself:
curl -vI https://example.com 2>&1 | grep -i tls
# look for "TLSv1.3 (OUT), TLS handshake, Client hello"
# and "SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384"
What the lock icon really means
The lock icon means: this connection is encrypted, and the server proved ownership of a certificate for this domain. That's genuinely valuable — it defeats eavesdropping and most tampering.
What it does *not* mean: "this website is legitimate." Getting a basic certificate only proves control of a domain, which takes minutes and (thanks to Let's Encrypt, below) costs nothing. Phishing sites routinely display the lock icon. A scam site at secure-login-verify-bank.com can have perfectly valid HTTPS. The lock protects the *pipe*, not the *person at the other end*.
Let's Encrypt: free certificates for everyone
Until 2015, certificates cost money and required manual renewal paperwork — a real barrier for small sites. Let's Encrypt, run by the nonprofit ISRG, changed that by offering free, fully automated certificates through a protocol called ACME. A server proves it controls a domain (usually by serving a challenge file), gets a certificate valid for 90 days, and software renews it automatically before expiry. Short lifetimes are a feature: less time for a compromised certificate to be abused. Today a huge share of the web's certificates come from Let's Encrypt, and "we can't afford HTTPS" is no longer an excuse.
Three misconceptions worth dropping
- "HTTPS means the site is trustworthy." No — it means the connection is encrypted and the domain is verified. Scammers use HTTPS too.
- "The lock means nothing can go wrong." Malware on your own device, a compromised site, or a phishing page you willingly typed your password into are all outside what TLS protects against.
- "HTTPS makes sites slower." The TLS 1.3 handshake costs one round trip — a few dozen milliseconds — and modern hardware encrypts at line speed. HTTP/2 and HTTP/3 actually *require* encryption and are faster than old plain HTTP.
FAQ
Is TLS the same as a VPN?
They solve different problems. TLS encrypts your traffic to one specific website. A VPN encrypts *all* your traffic and routes it through the VPN provider's server, hiding your destination from your local network and ISP. You can (and often do) use both at once.
Why do some sites still show "Not Secure"?
They serve pages over plain HTTP, or their certificate is expired, mismatched, or self-signed. Browsers have been progressively shaming plain HTTP for years — treat "Not Secure" on a login or payment page as a stop sign.
What is certificate pinning / HPKP? Should I care?
Pinning hard-codes which CAs a site may use, as a defense against rogue certificates. HPKP (the HTTP-header version) is deprecated after real-world foot-guns; modern apps sometimes pin inside the app itself. As a site visitor, you don't need to do anything.
Does HTTPS hide which sites I visit from my ISP?
Mostly, but not entirely. The page contents and URLs are encrypted, but the domain itself can leak through DNS queries and the SNI field in the handshake (unless encrypted DNS and Encrypted Client Hello are in use). A VPN hides more.