An HTTPS connection is established through a process called the TLS handshake:
- DNS resolution: The browser first resolves the domain name to an IP address via DNS — this step happens before encryption
- TCP connection: The browser connects to the server's IP address on port 443
- TLS handshake: The server presents its TLS certificate, the browser verifies it, and they negotiate encryption keys. The SNI extension reveals the hostname during this step
- Encrypted transfer: All subsequent data is encrypted — page content, headers, and responses are unreadable to anyone intercepting the traffic