Technology explained
How Does HTTPS Work? The Padlock, Certificates and Handshake
HTTPS wraps your connection to a website in encryption and checks that the site really controls the domain you typed, so others on the network cannot read or alter the traffic. It does not tell you whether the site itself is honest, because a malicious site can also have a padlock.
By CodingMarble · Published · 4 min read

What the padlock means, and what it does not
The padlock or similar icon near the address bar tells you one narrow thing: the connection between your browser and the site is encrypted, and the site proved it holds a valid certificate for that exact domain name. In other words, you are talking privately to whoever controls that domain. It says nothing about whether that owner is trustworthy.
That distinction is the most important thing to take from this guide. People often read the padlock as a seal of approval, and scammers rely on it. Getting a certificate for a domain is routine and inexpensive, so a fake shop or phishing page can show the same padlock as your bank. Always read the domain name itself, not only the icon. Browsers keep changing how they display security, so look at your own browser's help pages for what its current icons mean.
Encryption in transit
On plain HTTP, your data crosses many networks as readable text: the cafe's Wi-Fi, your internet provider, and every router along the way could read or change it. Anyone sharing your network could see which pages you opened and any form you submitted. Encryption in transit scrambles the data so that the people in the middle see only meaningless bytes, while the two ends can still read it. The underlying protocol is TLS, and HTTPS simply means HTTP running inside a TLS connection.
Two protections come together. Confidentiality means outsiders cannot read the traffic. Integrity means that if someone alters even a small part of it on the way, the change is detected and the connection fails. This is why a page delivered over HTTPS cannot be quietly modified to insert extra adverts or scripts by a network in the middle.
The handshake at a simple level
Before any page data moves, the browser and server perform a short negotiation called the handshake. Here is the idea without the mathematics, using a padlock analogy. The server has a public key that anyone may see, plus a matching private key that only it holds. Things locked with one can be proved with the other.
- Your browser says hello and lists the encryption methods and protocol versions it supports.
- The server picks a method and sends its certificate, which contains its public key.
- The browser verifies the certificate as described above.
- Using a key-agreement technique, both sides each compute the same fresh secret key without ever sending it across the network.
- From then on, both sides encrypt everything with that shared session key, which is fast and is discarded when the session ends.
The slow, clever public-key step is used only to agree on a secret and prove identity. The bulk of your traffic uses the faster shared key. Exact steps and speed differ between protocol versions, and details are best taken from current standards documents rather than memory.
What HTTPS does not protect
HTTPS protects the journey, not the destination. It does not stop a site from being fraudulent, from collecting the details you type into it, or from being hacked and serving malware over a perfectly valid connection. It does not hide that you visited a particular domain from your network, since the domain name is still visible in some of the setup traffic, though the specific pages and contents are not. It does not protect data after it arrives: whether a company stores your information safely is a separate question. And it cannot help if your own device is infected.
Practical tip: before entering a password or payment details, read the full domain in the address bar, watch for look-alike spellings, and prefer typing a known address or using a saved bookmark over following a link in a message.
How to check a certificate yourself, and why HTTP gets warnings
Click the icon beside the address in your browser and look for an option such as connection is secure, then certificate details. Wording differs by browser and version. You should see which domain names the certificate covers, who issued it, and the dates it is valid. If you work with servers, you can also read it from a terminal.
echo | openssl s_client -connect example.com:443 -servername example.com 2>/dev/null | openssl x509 -noout -issuer -subject -datesBrowsers warn about plain HTTP because the risks are concrete: on an unencrypted page, anything you type, including passwords and form entries, travels readable, and anyone on the path can change what you see. Most browsers now label HTTP pages as not secure and may stop pages from using sensitive features. If you move a site to HTTPS and then see broken images or scripts, the cause is often old http links, covered in the guide on mixed content errors.
Keep reading
- Hosting and planningInstall a Free SSL Certificate and Enable HTTPSA free SSL certificate, usually from Let's Encrypt, encrypts traffic between visitors and your server and proves your domain is yours. On shared hosting it is typically a one-click setting, and on a VPS you can issue and renew it with certbot and nginx.
- Error fixesFix Mixed Content Errors After Enabling HTTPSA mixed content error means a page loaded over HTTPS is still requesting something, an image, script or stylesheet, over plain HTTP, so the browser blocks or flags it. Find each offending URL in the DevTools console, change it to HTTPS at its source, and use a CSP upgrade rule only as a safety net.
- Everyday digital lifeSpot Phishing Emails and SMS Scams Before You ClickPhishing is a message that pretends to come from someone you trust, such as a bank, a courier or your manager, to push you into clicking a link, opening a file or handing over a code. The best defence is to slow down, check where a link really goes without opening it, and contact the organisation through a channel you already know.
- Web developmentWebsite Security Basics for Small BusinessesMost small business sites are compromised through outdated plugins, weak or reused passwords and missing basic server settings, not through clever attacks. Cover HTTPS, updates, authentication, security headers, form handling and tested backups, and you remove the common routes in.
Need this built properly for your business?
CodingMarble is a remote studio in India that builds websites, apps and games on fixed packages with the scope written down before payment. Try the free tools we run, or start a project when you are ready.