How does HTTPS secure communication between a browser and a server?
Interview preparation resource from Gate Smashers.
HTTPS secures web communication by running HTTP over TLS. TLS authenticates the server, establishes shared session keys, encrypts HTTP data, and detects tampering in transit. The browser validates the server’s certificate during the TLS handshake, then both sides use derived symmetric keys to protect requests and responses.

HTTPS and TLS
HTTPS is HTTP carried over Transport Layer Security (TLS). TLS creates a protected communication channel between the browser and the server before normal HTTP messages are exchanged. It provides confidentiality, integrity, and authentication of the server in the usual HTTPS deployment.
Connection setup and certificate validation
The browser first establishes the underlying transport connection. This is usually TCP for HTTP/1.1 and HTTP/2; HTTP/3 uses QUIC, which runs over UDP and incorporates TLS handshake functionality.
During the TLS handshake, the server presents a certificate containing its public key and identity information. The browser checks that the certificate chains to a trusted certificate authority, is valid for the requested hostname, and is within its validity period. The server also proves possession of the corresponding private key as part of the handshake.
Key agreement and protected data transfer
The browser and server negotiate TLS parameters and perform key agreement, commonly using ephemeral key exchange. They derive shared session keys without sending those final keys directly over the network. Ephemeral key exchange can provide forward secrecy, meaning that compromise of a server’s long-term private key does not normally reveal past sessions.
After the handshake, HTTP requests and responses are protected using symmetric cryptography. TLS encryption prevents network observers from reading the application data, while authenticated encryption or equivalent integrity mechanisms allow the recipient to detect altered, injected, or forged records.
Security boundaries
HTTPS protects data while it travels between the browser and the authenticated server endpoint. It does not prove that a website operator is honest, that the site is free from vulnerabilities, or that data remains protected after the server receives it. Client authentication is possible with TLS certificates, but it is not normally used for standard web browsing.
