Typing a web address and seeing a page feels instant, but you’re setting off a chain of steps. So, how do websites work? Your browser looks up the server, requests files, and assembles them into the page.
This guide is part of our web development basics series.
| Item | Value |
|---|---|
| Server’s success reply to a page request | 200 OK |
| Typical size of the first chunk of content | 14KB |
| Structures built from HTML and CSS when parsing | DOM and CSSOM |
| Full TLS 1.3 handshake cost | one round trip |
| Full TLS 1.2 handshake cost | two round trips |
These figures come from MDN’s How the web works and Populating the page guides. Details can change, so check the sources before you rely on them.
Clients and servers: the two sides of every page
Every page load involves a client and a server. Clients are your internet-connected devices, such as a laptop on Wi-Fi or a phone on a mobile network, plus the browser running on them. Servers are different machines: MDN says “Servers are computers that store webpages, sites, or apps.”
When you visit a site, a copy of the page’s code travels from the server to your device. In MDN’s wording, the copy is downloaded “to the client machine, where it is rendered by the browser and displayed to the user.”
Two tools make that exchange possible. Your internet connection carries the data, and a shared language called HTTP lets the two sides understand each other. MDN describes HTTP as “an application protocol that defines a language for clients and servers to speak to each other.”
Step one: DNS finds the server
You type a name like a domain, but computers locate each other by number. That is why the Domain Name System exists, and MDN compares it to “an address book for websites.”
The lookup turns a human-friendly name into an IP address. MDN’s DNS glossary gives 192.0.2.172 as an example of such a numeric address, and calls the mapping process a DNS lookup.
Your browser needs that answer first. As MDN puts it, the browser looks at the DNS “to find the website’s IP address – the actual address the server is located at – before it can retrieve the website.”
Connecting, requesting and receiving the files
With an address in hand, the browser opens a connection to the server. For secure sites, a further TLS handshake sets up encryption and checks the server’s identity. MDN notes that “A full TLS 1.3 handshake takes one round trip to the server before the browser can send the content request; a full TLS 1.2 handshake takes two.”
Then the browser sends an HTTP request. Here is the sequence in plain steps:
- The browser sends a request message asking the server for a copy of the site.
- If the server agrees, it replies with a status code, “200 OK” for success.
- The server streams the site’s files back as small chunks called packets.
- The browser assembles those chunks into a complete page and shows it to you.
Not every request succeeds. MDN lists the common HTTP response codes as 200, 301, 403, 404 and 500, which is why you sometimes land on a “not found” page instead of the site.
Packets matter because the first one sets the pace. According to MDN, “The first chunk of content is usually 14KB of data.” Even when a page’s HTML is larger, the browser starts working with what it already has.
How websites work on screen: what the browser does with the files
Once data arrives, the browser begins parsing. MDN defines it as the step that turns “the data it receives over the network into the DOM and CSSOM, which is used by the renderer to paint a page to the screen.”
The DOM is a tree built from your HTML, and the CSSOM does the same for your styles. The browser combines them into a render tree. Items that will not appear, such as the head element, are left out.
Next comes layout. MDN explains that “Layout is the process by which the dimensions and location of all the nodes in the render tree are determined.” After layout, the browser paints pixels to the screen.

The browser builds an accessibility tree alongside the DOM too, which assistive devices use to read the page. That is one reason clean HTML matters beyond looks.
Which code does which job on this journey is the subject of front end vs back end development, and that split shapes many career choices. If you want to work on these layers yourself, see how to become a web developer.
Why some pages feel slow
Slowness usually traces back to one of the steps above. Each unique hostname a page references needs its own lookup: as MDN observes, “If your fonts, images, scripts, ads, and metrics all have different hostnames, a DNS lookup is needed for each one.”
Heavy scripts are another culprit. A helper called the preload scanner requests high-priority resources early, yet MDN warns that “large scripts can still cause a significant bottleneck.”
Finally, there is the main thread. MDN says it “needs to complete all the work we throw at it and still be available to handle user interactions,” so less work on it means a snappier page.
Frequently asked questions
Do I need to know all of this to build a website?
Show answer
No. A site builder hides most of it, but knowing the path from request to paint helps you diagnose problems and talk sensibly with developers or hosts.
Is a domain name the same as a server?
Show answer
No. The domain is only a label that DNS maps to a numeric address, and that address points to the machine holding the site’s files.
What does a “not found” error mean?
Show answer
It is one of the response codes a server can return. The server was reached, but it had nothing to give for the address you asked for.
Does HTTPS make a page load more slowly?
Show answer
Secure connections add a handshake before the request, as MDN’s performance guide describes. Newer TLS versions need fewer round trips, so the cost is small.



