Programming
We provide developers and engineers the guides and tutorials they...
Search
We provide developers and engineers the guides and tutorials they...
Content is king. It's not just about how you're going to write, b...
Looking for an engaging connection with thousands of other people...
How HTTPS keeps your data safe: encryption, certificates, certificate authorities and the TLS 1.3 handshake, explained step by step for developers.
Over plain HTTP, everything you send (passwords, card numbers, messages) crosses the internet as readable text. Any router, Wi-Fi hotspot or ISP along the way could read or change it. HTTPS is HTTP sent through an encrypted tunnel built by TLS (Transport Layer Security).
Quick answer: When you open an HTTPS site, your browser and the server run a TLS handshake. They agree on encryption settings, the server proves its identity with a certificate signed by a trusted certificate authority (CA), and both sides derive the same secret session keys without ever sending them. Everything afterwards is encrypted with those keys. In TLS 1.3, this takes a single round trip.
HTTPS gives you three guarantees:
| Guarantee | Protects against | How |
|---|---|---|
| Confidentiality | Eavesdroppers reading your data | Symmetric encryption with session keys |
| Integrity | Attackers changing data in transit | Authenticated encryption detects any tampering |
| Authentication | Impostors pretending to be the site | Certificates signed by trusted CAs |
You'll still hear the name SSL. SSL was TLS's predecessor and is long obsolete, but "SSL certificate" stuck as a name.
TLS combines two kinds of cryptography, because each is good at a different job.
Symmetric encryption uses one shared key to both lock and unlock data. Algorithms like AES and ChaCha20 are extremely fast, so they encrypt all the actual page data. The catch: both sides need the same key, and you can't just send it over the wire, because an eavesdropper would copy it.
Asymmetric (public-key) encryption uses a key pair. The public key can be shared with the world; only the matching private key can undo or sign with it. It's much slower, so TLS uses it only during the handshake. Cloudflare's guide to public key cryptography explains the maths intuitively.
TLS 1.3 uses an ephemeral Diffie-Hellman key exchange (usually elliptic-curve, ECDHE). Each side generates a temporary key pair and sends only the public half. Through some clever maths, both sides compute the same shared secret, while an eavesdropper who sees both public halves cannot. The temporary keys are thrown away after the session, which gives forward secrecy: even if the server's long-term private key leaks years later, recorded traffic stays unreadable.
Key exchange alone isn't enough. You could be doing a perfect key exchange with an attacker sitting in the middle. The server needs to prove it really is yourbank.com.
That's the job of a certificate. It contains the domain name, the server's public key, an expiry date, and a signature from a certificate authority. Your browser and operating system ship with a list of trusted root CAs. The check works as a chain:
CAs must verify that whoever requests a certificate actually controls the domain. Let's Encrypt made this free and automatic with the ACME protocol: your server proves control by placing a file on the site or a DNS record, and certificates renew themselves. Issued certificates are also published in public Certificate Transparency logs, so mis-issued certificates can be spotted.
The handshake happens right after the TCP connection opens, as the fourth stage of what happens when you type a URL. Here is the full exchange in TLS 1.3, defined in RFC 8446:

From here on, all data is protected with fast symmetric encryption (typically AES-GCM or ChaCha20-Poly1305), which both encrypts and authenticates each record.
TLS 1.2 needed two round trips before data could flow. TLS 1.3 cut that to one by having the browser guess the key exchange method and send its key share up front. It also removed old, weak options like RSA key exchange and outdated ciphers. Cloudflare's handshake explainer compares both versions.
For repeat visits, TLS 1.3 supports session resumption, and even 0-RTT mode, where the browser sends its request in the very first message using a key from the previous session. 0-RTT data can be replayed by an attacker, so servers only accept it for safe, repeatable requests.
HTTP/3 goes further by merging the transport and TLS handshakes into one inside QUIC.
HTTPS is essential, but it's easy to overestimate. Here's what it leaves exposed:
301 redirect from HTTP to HTTPS, then send a Strict-Transport-Security header so browsers never try HTTP again.HTTPS is HTTP carried inside a TLS-encrypted connection, usually on port 443 instead of 80. The requests and responses are the same; only the transport is protected.
TLS is the successor to SSL. All SSL versions are deprecated and insecure. People still say "SSL certificate," but modern sites use TLS 1.2 and 1.3.
Barely. TLS 1.3 adds one round trip to a new connection, and encryption itself is cheap on modern hardware. HTTPS also unlocks HTTP/2 and HTTP/3 in browsers, which often makes sites faster overall.
Browsers show a full-page security warning and many users leave. On sites with HSTS, users can't click through at all. Automated renewal prevents this.
Not without a certificate the browser trusts for that domain. Some corporate networks install their own root certificate on company devices so they can inspect traffic. On a personal device, a certificate warning is a sign something is wrong.
A property where session keys come from temporary key pairs that are discarded afterwards. Even if the server's private key is stolen later, previously recorded sessions can't be decrypted. TLS 1.3 always provides it.
HTTPS combines two kinds of cryptography: slow public-key maths to agree on secrets and prove identity, then fast symmetric encryption for everything else. Certificates and CAs answer the hardest question, "am I really talking to this site?", and TLS 1.3 does all of it in a single round trip. It's the reason you can type a password into a café Wi-Fi network without handing it to strangers.