HTTPS works by using SSL/TLS to encrypt data between the client and server. When a user connects to a website, the server sends its SSL certificate to the client for verification. Once verified, a secure connection is established through a handshake process, where session keys are exchanged.
This ensures that all data transmitted is encrypted and secure from eavesdroppers. Additionally, HTTPS protects against man-in-the-middle attacks by ensuring authenticity and integrity of the data.