Networking

What HTTPS Stands For and How It Works

HTTPS stands for HyperText Transfer Protocol Secure. It is the ordinary web protocol, HTTP, carried inside an encrypted TLS connection, so that the page you request, the data you send and the identity of the server are protected on the way.

MDN defines it as "an encrypted version of the HTTP protocol" that "uses TLS to encrypt all communication between a client and a server." The rest of this article explains what the extra S actually changes, step by step, and what it leaves alone.

The name, word by word

Each part of the abbreviation has a job:

  • HyperText: text that links to other documents, which is the kind of content web pages are made of.
  • Transfer Protocol: the agreed rules a browser (the client) and a web server follow to request and deliver those documents. A request such as GET /index.html and a response with a status code are both defined by the protocol.
  • Secure: the same exchange, protected by TLS (Transport Layer Security).

So HTTP is the conversation, and the S is the sealed channel the conversation happens in. The messages themselves do not change.

What "secure" means in the standard

The current HTTP specification, RFC 9110, is precise about the word. A connection counts as secured for an https address when the server has been authenticated as acting on behalf of the identified authority, and when all HTTP communication with that server has confidentiality and integrity protection. That is three separate guarantees:

  • Authentication: you are talking to the server that is entitled to use the name in the address bar, not to someone pretending to be it.
  • Confidentiality: someone watching the network cannot read the traffic.
  • Integrity: someone on the path cannot change the traffic without being detected.

Plain HTTP offers none of the three. On an open network, anyone between you and the server can read what you send and alter what comes back.

How an HTTPS request works

RFC 2818, the original "HTTP Over TLS" memo, describes the idea simply: run HTTP over TLS the way you would run it over plain TCP. It has since been made obsolete by RFC 9110, but its description of the order of events still matches how browsers behave. In outline:

  1. You enter or click an https:// address. The scheme tells the browser to use TLS.
  2. The browser opens a TCP connection to the server, to port 443 unless the address names another port.
  3. The browser acts as the TLS client. RFC 2818 says the HTTP client also acts as the TLS client and sends a TLS ClientHello to begin the handshake.
  4. The server presents a certificate. The browser checks that the certificate is valid and that it matches the hostname in the address.
  5. Both sides agree on keys for encrypting the rest of the connection.
  6. Only then does HTTP start. The request and the response travel inside the encrypted channel.

The handshake in steps 3 to 5 is the part that differs between TLS versions, and it is covered in the TLS handshake explained. The certificate in step 4 is explained in what a TLS certificate is.

The hostname check

Encryption alone would not help if you were encrypting traffic to the wrong party, so the client checks the name. RFC 2818 says the client must compare the hostname it meant to reach with the identity in the server's certificate. If the certificate carries a subjectAltName extension of type dNSName, that is the identity to use. Wildcards are allowed in one position: *.a.com matches foo.a.com but not bar.foo.a.com. If the name does not match, the browser shows a warning instead of loading the page.

Ports and URLs

An https address has the same shape as an http one, with a different scheme and default port:

http://example.com/page    -> TCP port 80 by default
https://example.com/page   -> TCP port 443 by default

RFC 9110 states both defaults. For http, "TCP port 80 (the reserved port for WWW services) is the default." For https, "TCP port 443 (the reserved port for HTTP over TLS) is the default." If a site runs on another port, the address says so, for example https://example.com:8443/.

Why the S matters in practice

Without it, a login form on an open Wi-Fi network sends the username and password in readable text. With it, the same form data is encrypted before it leaves your device. The same goes for cookies, which often act as your logged-in session: over HTTP they can be read or reused by someone watching the network, and over HTTPS they cannot.

HTTPS also stops tampering. A network that can edit plain HTTP responses can insert advertisements, change download links or add scripts to a page. Over HTTPS, a modified message fails the integrity check and the connection breaks instead of delivering the altered page.

What HTTPS does not do

It helps to be exact about the limits, because the padlock is often read as more than it says.

  • It does not say the site is honest. It proves which host you reached and protects the traffic to it. A fraudulent site can have a valid certificate for its own domain.
  • It does not hide that you visited. Your network can still see the server's address and, in most setups, the hostname. It cannot see the page path or contents.
  • It does not protect the server. A site with an insecure login system or an unpatched application is just as vulnerable over HTTPS.
  • It does not protect data after delivery. What the server stores, and who it shares it with, is outside the connection.

The full comparison, including redirects, HSTS and mixed content, is in HTTP vs HTTPS.

HTTPS, SSL and TLS: the naming

You will see "SSL" used loosely in connection with HTTPS, as in "SSL certificate". RFC 2818 itself says current practice is to layer HTTP over "SSL/TLS". SSL is the older name for the technology; TLS is its standardised successor, and TLS is what current browsers and servers use. The distinction is covered in SSL vs TLS. For the question this article answers, the short version is that the S in HTTPS means Secure, and the security comes from TLS.

How to tell a page uses HTTPS

Look at the start of the address. If it begins with https://, the page was loaded through TLS. Browsers also show a lock or similar icon near the address bar, and they warn you when a certificate is expired, issued for a different name or otherwise invalid. If you see such a warning on a site where you were about to enter a password, stop and do not click through.

To inspect a certificate in detail, see how to check an SSL certificate.

Frequently asked questions

What does the S in HTTPS stand for?
The S stands for Secure. HTTPS is HyperText Transfer Protocol Secure: ordinary HTTP carried inside a TLS connection, so the traffic is encrypted and the server has to prove its identity.
Is HTTPS a different protocol from HTTP?
Not in the sense of different requests. The messages are the same HTTP messages. What changes is the transport: with HTTPS they travel through a TLS connection instead of directly over TCP, and the URL scheme is https instead of http.
Does HTTPS stand for Hypertext Transfer Protocol Secure or Secured?
Secure is the form MDN uses: HyperText Transfer Protocol Secure. You will occasionally see 'over Secure Sockets Layer' or 'Secured' in older material, but the S means Secure.
What port does HTTPS use?
TCP port 443 by default. RFC 9110 says that if an https URL has no port, 443 is used, and that it is the reserved port for HTTP over TLS. Plain HTTP uses TCP port 80.
Does HTTPS mean the website is trustworthy?
No. It means the connection is encrypted and the server proved it is the host named in the address. It says nothing about the honesty of whoever runs that host.

Sources