HTTP vs HTTPS

HTTP (Hypertext Transfer Protocol) sends requests and responses between browser and server as plain text that anyone on the network can read or alter. HTTPS is the same protocol running over TLS (Transport Layer Security), which verifies the server with a certificate and encrypts all traffic so it cannot be read or tampered with in transit.

4 min read

HTTP (Hypertext Transfer Protocol) is the protocol browsers and servers use to exchange web pages, forms, and API data. HTTPS is the same protocol, running on top of TLS (Transport Layer Security), which encrypts everything before it goes on the wire. The content and structure of the request and response are identical either way; what changes is whether anyone in between can read or alter them.

How it works

A plain HTTP request travels as readable text: the method, the path, the headers, the body, all visible to anything that can see the network traffic, a public WiFi hotspot, an ISP, a compromised router. Anyone watching can read passwords typed into a login form or a session cookie and reuse it to impersonate the user.

HTTPS adds a TLS layer underneath HTTP (this combination is sometimes written as HTTP over TLS). Before any HTTP data is sent, the client and server perform a TLS handshake: they agree on an encryption method, the server proves its identity using a certificate signed by a trusted certificate authority, and both sides derive a shared secret key. Every byte of the actual HTTP request and response is then encrypted with that key.

The TLS handshake, step by step

  1. Client Hello. The browser tells the server which TLS versions and cipher suites it supports, and sends a random value.
  2. Server Hello. The server picks a TLS version and cipher suite, sends its own random value, and sends its certificate (which contains its public key and is signed by a certificate authority).
  3. Certificate verification. The browser checks the certificate against a list of trusted certificate authorities baked into the OS or browser. If it's valid and matches the domain being visited, the browser trusts the server's identity.
  4. Key exchange. Client and server use public-key cryptography (commonly Diffie-Hellman in modern TLS) to agree on a shared secret, without ever sending that secret itself over the network.
  5. Symmetric encryption begins. Both sides derive a symmetric session key from the shared secret. From this point on, the actual HTTP traffic is encrypted with fast symmetric encryption using that key.

Modern TLS (1.3) collapses this into fewer round trips than older versions, but the same core ideas (identity verification, then a shared secret, then symmetric encryption) still apply.

A worked example

Visiting http://example.com/login with a password in the form body: anyone on the same network can run a packet capture tool and read the password field directly out of the request, because it's plain text.

Visiting https://example.com/login for the same form: the packet capture only shows encrypted bytes. Without the session key (which never crosses the network in a readable form), the captured data is computationally infeasible to decrypt.

Where this matters in real systems

Every major browser now marks plain HTTP sites as "Not Secure" in the address bar, and Google has confirmed HTTPS is a search ranking signal, both strong real incentives for sites to migrate. Let's Encrypt made this close to free by offering automated, trusted TLS certificates at no cost, which is a large part of why HTTPS adoption across the web grew so fast after it launched. Login pages, payment forms, and anything handling personal data are the highest-stakes places HTTPS matters, but it protects every request on a page, not just the sensitive ones.

What interviewers actually ask about HTTP vs HTTPS

  • "What's the actual difference between HTTP and HTTPS?" HTTPS is HTTP running over TLS encryption; the protocol and data format are the same, but HTTPS encrypts the traffic so it can't be read or modified in transit.
  • "Walk me through what a TLS handshake does." Expect the shape above: agree on a cipher, verify the server's certificate, derive a shared secret, switch to symmetric encryption.
  • "Why does TLS use both asymmetric and symmetric encryption?" Asymmetric encryption is used briefly to safely establish a shared secret without sending it in the clear; symmetric encryption is much faster and handles the actual bulk data transfer afterward.
  • "What does a certificate actually prove?" That a trusted certificate authority has verified the server controls the domain in question, so the client can trust it's really talking to the real example.com and not an impersonator.

Key takeaways

  • HTTP sends data in plain text; HTTPS encrypts the same data using TLS.
  • The TLS handshake verifies the server's identity via a certificate, then establishes a shared encryption key.
  • HTTPS uses asymmetric encryption briefly to set up a shared secret, then fast symmetric encryption for the actual traffic.
  • Browsers now actively flag plain HTTP sites as insecure, and free certificate authorities like Let's Encrypt removed the cost barrier to adopting HTTPS.
All 101 Computer Networks interview questions

Log in to save which topics you've read across every subject.

Frequently asked questions

What's the actual difference between HTTP and HTTPS?

HTTPS is HTTP running over TLS encryption; the protocol and data format are the same, but HTTPS encrypts the traffic so it can't be read or modified in transit.

Walk me through what a TLS handshake does.

Expect the shape above: agree on a cipher, verify the server's certificate, derive a shared secret, switch to symmetric encryption.

Why does TLS use both asymmetric and symmetric encryption?

Asymmetric encryption is used briefly to safely establish a shared secret without sending it in the clear; symmetric encryption is much faster and handles the actual bulk data transfer afterward.

What does a certificate actually prove?

That a trusted certificate authority has verified the server controls the domain in question, so the client can trust it's really talking to the real example.com and not an impersonator.