How the Web Works
What happens, step by step, between typing a web address and seeing the page.
What is it?
You type an address, press enter, and a page appears. It feels instant, but it's a chain of hand-offs between machines you never see.
1. Look up. The address you typed is a human-friendly name, not a location a computer can connect to. A lookup step turns the name into the numeric address of a specific machine.
2. Request. Your browser sends that machine a message: "please send me the page at this address." The machine is a server, a computer that listens for these requests all day.
3. Respond. The server sends back a response. It might be a file on disk, or something it builds on the spot from a database. Usually it's a document that describes the page's content and structure.
4. Render. Your browser reads the document, fetches any extra files it mentions (images, styles, code), and paints everything on screen.
Look up, request, respond, render: that's how the web works. Later topics look at each step in detail.
Explain like I'm 10
It's like mailing a letter to a company when you only know its name. A directory looks up the street address, the letter travels there, someone writes a reply, and the reply travels back to your mailbox.
Examples
The trip a request takes
1. You type: example.com
2. Browser looks up which server "example.com" points to
3. Browser sends: "GET / please"
4. Server sends back: an HTML document
5. Browser reads the document and displays itThe whole round trip in plain steps. No protocol names yet, just the shape of the conversation.
A page is rarely just one file
index.html <- the page structure
├── styles.css <- fetched separately, for appearance
├── logo.png <- fetched separately, an image
└── app.js <- fetched separately, for behaviorThe first document almost always references more files. The browser spots those references and fetches each one, so one page usually means several requests.
How it works
The process rests on three systems working together:
- a naming system that maps readable addresses to machine locations
- a network that carries messages between any two connected computers
- a shared format that browser and server both use to ask for and describe a page
Your operating system and browser handle the actual networking. At this level, what matters is the sequence: look up, request, respond, render.
[ You ] --type address--> [ Browser ]
|
1. look up server
|
v
[ Naming lookup ]
|
2. send request
v
[ Server ]
|
3. send response
v
[ Browser renders ]
|
v
[ Page shown ]Why does it exist?
The web was built to connect any browser to any server, run by different people on different machines anywhere in the world. Splitting the job into separate steps (naming, requesting, responding, rendering) let each piece be built and improved on its own.
That's why typing an address into any browser works, no matter who built the browser or runs the server.
When to use it
Use this model when a site is slow or broken and you need to find where the problem is. Is the lookup failing, is the server not responding, or is the page failing to render?
Every deeper web topic (HTTP, DNS, rendering, caching) is a closer look at one step of this journey.
When not to use it
Everyday tasks like writing HTML or styling a button live entirely in the "render" step, so you don't need the whole chain for them. The model helps most when something crosses between browser and server, or goes wrong.
Common mistakes
Thinking the address you type is the server's location, not a name that gets looked up.
Assuming a webpage is one file, when it's usually a document plus many separately fetched files.
Believing the page 'just appears', when the browser builds it step by step after the response arrives.
Practice exercises
- Easy:
In your own words, list the four main steps between typing an address and seeing a page.
- Medium:
Open your browser's developer tools, go to the Network panel, and reload a page. Count how many files were fetched to build it.
- Hard:
For each of the four steps (lookup, request, response, render), explain what might go wrong and how the symptom would look to a user.
Interview questions
At a high level, what happens between typing a URL and seeing a page?
The browser looks up which server owns the address (DNS), opens a connection and sends a request, gets back a response with the page's content, and renders it on screen.
Is a webpage usually a single file?
No. The first HTML document usually references other files (stylesheets, images, scripts). The browser finds them while parsing and fetches each one separately, often many at once.
Why does the web need a naming lookup step at all?
People use readable names like example.com, but computers need a numeric IP address to open a connection. DNS translates one into the other.
What is DNS, and what does it actually return?
DNS (Domain Name System) is the web's naming lookup. Given a domain name, it returns the IP address of a server for that domain, which the browser then connects to.
Why is looking up the same domain often faster the second time?
Browsers, operating systems, and network resolvers cache DNS answers for a set time (the TTL). A repeat lookup can come from cache instead of doing the full lookup again.
What's the difference between a domain name and an IP address?
A domain name is a readable label like example.com. An IP address is the numeric address of the machine the browser actually connects to. DNS maps one to the other.
What role does a port number play in a request, and what are the default ports for HTTP and HTTPS?
One machine can run many services, and the port says which one should handle the connection. HTTP defaults to port 80 and HTTPS to port 443, so you don't need to type them in a URL.
What's the difference between HTTP and HTTPS?
HTTPS is HTTP over an encrypted connection (TLS). The requests and responses are the same, but anyone intercepting the traffic can't read or tamper with it.
What does it mean for HTTP to be a request/response protocol?
The browser (client) always starts by sending a request, and the server replies with a response. The server never pushes a page to a browser that didn't ask for it.
What do the main HTTP status code categories mean?
2xx means success. 3xx means redirect to another location. 4xx means the client's request was invalid or unauthorized (like 404 Not Found). 5xx means the server failed while handling a valid request.
What happens when a server responds with a redirect?
The server sends a 3xx status code and a Location header with a different URL. The browser automatically requests that URL instead of rendering the redirect response.
Why might a website use a CDN, and how does that change which server you actually talk to?
A CDN (content delivery network) serves cached copies of a site's files from servers close to the visitor. DNS for the domain points to a nearby CDN server instead of the site's single origin server, which cuts latency.
What's the difference between latency and bandwidth?
Latency is how long one piece of data takes to make the round trip. Bandwidth is how much data can move per second once the connection is flowing. A high-bandwidth connection can still feel slow if latency is high.
Why can a page technically finish loading but still show a blank screen for a while?
Getting the response is only one step. The browser still has to parse the HTML, fetch referenced files, compute layout, and paint pixels. A slow render step can delay the visible page long after the network work is done.
What's the difference between a client and a server in this model?
The client (usually a browser) sends requests and renders what comes back. The server listens for requests and decides what to send. The same machine can play either role in different contexts.
How would the symptoms differ between a DNS failure, a server being down, and a rendering failure?
A DNS failure shows an error before any connection is tried, often 'server not found.' A down server shows a connection error after the lookup succeeds. A rendering failure can show a blank or broken page even though the request completed normally.
Why is the very first request to a site often slower than later ones?
The first request pays for the DNS lookup, opening a TCP connection, and (for HTTPS) a TLS handshake. Later requests skip all of that if the browser reuses the same connection.