What actually happens when you type a website address and press enter.
When you type example.com into your browser and hit Enter, your computer goes through several steps to retrieve and display the webpage. Here’s how it works:
NAME LOOKUP (DNS): Your computer doesn't understand names; it only understands numbers (IP addresses). It sends a request to a DNS server asking "What number is example.com?" The DNS server responds with an IP address, such as 93.184.216.34. This is similar to looking up a phone number for a name.
CONNECT (TCP): Your computer opens a connection to the IP address using TCP. It sends a quick "hello" handshake so both sides agree they are talking.
SECURE IT (TLS/HTTPS): The browser and server establish an encrypted connection with TLS or HTTPS, ensuring that no one can intercept the data being sent. The server proves its identity by sending a certificate to the browser.
ASK (HTTP request): Your browser sends a "GET /" request along with details about the browser itself, such as the user agent string.
ANSWER (HTTP response): The server responds with the webpage content, which may include HTML text and additional resources like images, stylesheets, and scripts. Each of these resources often requires separate requests from the browser.
DRAW (rendering): The browser interprets all this data to render the final webpage you see on your screen.
All of this typically happens in under a second. However, each step can fail, leading to different error messages such as "server not found," "certificate warnings," or slow loading times. Understanding which layer failed is crucial for troubleshooting issues.
This breakdown helps you understand the layers involved and how to diagnose problems when they arise.
sequenceDiagram participant U as Your Browser participant D as DNS Resolver participant S as Web Server U->>D: What is the IP for example.com D->>U: The IP address U->>S: TCP connect then TLS U->>S: GET the page S->>U: HTML then images and scripts