TodayTools

HTTP over TLS

How HTTPS works

The same web, locked so nobody can read it

Donate
L7ApplicationPort 443TCP
What brings you here?

Watch it happen

How much detail

Opening https://www.example.com: TCP, a one round trip TLS 1.3 handshake, then an encrypted page.

Your laptop
Home router
Internet
www.example.com
Wi-FiInternetSetupRequestControlResponseEncrypted

5 steps, 10 packets

First up: TCP connection. Press Play to watch it happen, one step at a time.

0 of 50/5

What is HTTPS?

HTTPS is ordinary HTTP sent inside a TLS connection. Before any request goes out, the browser and the server agree on secret keys and the server proves its identity with a certificate. From then on every request and response is encrypted and protected from changes.

The padlock in the address bar means HTTPS is on. It stops people on the same Wi-Fi, your internet provider or anyone on the path from reading passwords, cookies or pages, or slipping in their own content. Nearly all web traffic now uses it.

Think of it like this. Plain HTTP is a postcard that every postal worker can read. HTTPS is a locked box: you first check the courier's ID badge (the certificate), then you both agree on a key, and only then does anything go in the box. People can still see the box and where it is going, but not what is inside.

Step by step

Normal

5 steps

Opening https://www.example.com: TCP, a one round trip TLS 1.3 handshake, then an encrypted page.

  1. 1

    TCP connection

    Three packets to port 443

    HTTPS starts like HTTP: a TCP handshake. The name lookup already happened and is cached. Only the port is different.

  2. 2

    Client Hello

    The browser offers locks and a key share

    The browser lists the ciphers it knows, names the site (SNI) and sends its half of a key exchange. Sending the key share at once is what makes TLS 1.3 fast.

  3. 3

    Server Hello and certificate

    The server proves who it is

    The server picks a cipher, sends its key share and from then on encrypts everything. Its certificate, signed by a trusted authority, proves it really is www.example.com.

  4. 4

    Finished

    Both sides check the handshake

    Each side sends a Finished message, a checksum over everything said so far. If anyone changed a single byte on the way, the check fails and the connection stops.

  5. 5

    Encrypted HTTP

    Same request, now unreadable on the way

    The GET and the page travel inside TLS records. An onlooker sees only sizes, timing, the server address and the site name in the Client Hello.

Expired certificate

3 steps

The server's certificate ran out last week, so the browser stops before sending anything private.

  1. 1

    TCP and Client Hello

    Same start as always

    The browser opens TCP and sends its Client Hello. Nothing has gone wrong yet.

  2. 2

    Old certificate

    The server sends a certificate that ended

    The certificate was valid until 14 November 2026. Today is later, so it no longer proves anything. Certificates expire so that lost or stolen keys stop working.

  3. 3

    Browser says no

    Fatal alert, then the line closes

    The browser sends a fatal alert and closes the connection. No request, cookie or password was ever sent. You see a full-page warning instead of the site.

Return visit

4 steps

Coming back a few minutes later: a session ticket lets the server skip the certificate.

  1. 1

    TCP connection

    A fresh connection

    The old connection was closed, so TCP starts again.

  2. 2

    Client Hello with ticket

    Here is the ticket you gave me

    The browser adds the session ticket from last time as a pre-shared key. It still sends a fresh key share, so a stolen ticket alone cannot unlock old traffic.

  3. 3

    Short answer

    No certificate this time

    The server opens its ticket, recognises the session and replies without the certificate chain. The server flight drops from about 5 KB to about 1.4 KB.

  4. 4

    Request

    Straight to the page

    After Finished the request flows as before. Fewer bytes and less work for both sides.

Myths and mix-ups

  • The padlock means the site is safe or honest; it only means the connection is private and goes to the named site.
  • HTTPS hides which sites you visit; the server name and IP address are still visible to your network.
  • HTTPS is slow; with TLS 1.3 it adds one round trip, and resumption makes return visits cheaper.
  • Only login pages need HTTPS; any page can be changed on the way, for example to inject ads or malware.
  • A certificate keeps a site's data safe once it arrives; it only protects data while it travels.

Try it yourself

Run these on your own computer to see HTTPS at work.

  • Watch the TLS handshake

    curl -v https://example.com/ -o /dev/null

    Lines starting with * show the TLS version, cipher and certificate details.

  • Read a site's certificate

    openssl s_client -connect example.com:443 -servername example.com </dev/null

    Shows the certificate chain, the protocol and the cipher chosen.

  • See the expiry dates

    openssl s_client -connect example.com:443 -servername example.com </dev/null 2>/dev/null | openssl x509 -noout -dates

    notBefore and notAfter are when the certificate starts and stops being valid.

  • In the browser

    Click the icon left of the address, then the connection or certificate details

    Shows who issued the certificate and when it expires.

HTTPS at a glance

Layer
Application (7), on TLS
Default port
443
Transport
TCP, or QUIC for HTTP/3
Lock
TLS 1.3 (TLS 1.2 still common)
Handshake cost
1 round trip on top of TCP
Identity
X.509 certificate from a trusted authority
URL scheme
https://

Defined inRFC 9110RFC 2818RFC 8446RFC 5280RFC 6797

Test yourself

Question 1 of 5Score 0

What does the server's certificate prove?

Questions people ask

What is the difference between HTTP and HTTPS?

HTTPS is HTTP inside TLS. The requests are the same, but they are encrypted and the server proves its identity with a certificate, so nobody on the path can read or change them.

Which port does HTTPS use?

Port 443 over TCP. HTTP/3 uses UDP port 443 instead.

Does HTTPS hide the websites I visit?

Not fully. The full address, page and cookies are hidden, but the server's IP address and usually its name are visible to your network and provider.

Why does my browser say the connection is not private?

The certificate failed a check: it expired, is for a different name, or is not signed by a trusted authority. A wrong clock on your device can also cause it.

Is HTTPS slower than HTTP?

Barely. TLS 1.3 adds one round trip when connecting, and modern chips encrypt very fast. HTTP/2 and HTTP/3 only run over HTTPS in browsers, so it is often faster overall.

Donate