Home / Articles

From Address Bar to Pixels: How a Browser Loads a Web Page

A beginner-friendly walk through DNS lookup, the HTTP request and response, and how the browser turns HTML, CSS and JavaScript into the page you see on screen.

Publisher: REACTAPP.TOP5 min read1264 words

This article is published in English.

Sources: The Invisible Journey: What Really Happens When You Open a Website?

Typing example.com and pressing Enter feels instant, but several distinct steps happen before anything appears on screen. When you are starting out in web development, terms like DNS, server, HTML, CSS and JavaScript can feel like separate topics. This article connects them into one sequence, so you have a mental model you can hang later topics on, from APIs to rendering performance.

The journey has four stages: finding the site, asking it for content, receiving that content, and turning it into a visible page.

Stage 1: Finding where the website lives

People identify websites by name. Names like these are easy to remember:

example.com
google.com
youtube.com

Computers on a network, however, address each other by IP addresses, numeric identifiers such as 203.0.113.10 for IPv4 or longer hexadecimal forms for IPv6. Before the browser can contact a site, it has to translate the name into an address. That is the job of DNS, the Domain Name System.

A good way to picture DNS is the contact list on your phone. You store and search for people by name, and the phone looks up the number for you. You never need to memorize the digits. DNS does the same for the web: you type a domain name, and DNS supplies the address of the machine that serves it.

In practice, the lookup is layered and heavily cached. The browser first checks its own cache, then the operating system's, and only then asks a DNS resolver, usually run by your internet provider or a public DNS service. If the resolver does not already know the answer, it works its way through the DNS hierarchy until it finds the servers responsible for that domain. Because of caching, a site you visited recently usually resolves almost immediately.

Stage 2: Sending the request

With an IP address in hand, the browser can contact the site's server: a computer whose job is to store, generate and deliver the files and data a website needs.

Before any web content moves, the browser opens a connection to that server. For a modern https:// site, this also involves a TLS handshake, in which the two sides agree on encryption keys and the browser checks the server's certificate so it knows it is talking to the real site. Only then does the browser send an HTTP request.

On its way, the request travels across many networks and devices, such as your router, your provider's equipment and various intermediate routers, before it reaches the server. Stripped to its meaning, the request says: "Please send me what I need to display this page." It also carries details such as the exact path requested, the browser's supported formats and any cookies for that site.

Stage 3: Receiving the response

The server processes the request and replies with an HTTP response. The first response is usually an HTML document, and that document refers to further resources the browser then requests as well, including:

  • HTML documents
  • CSS stylesheets
  • JavaScript files
  • Images
  • other data, such as fonts or JSON from an API

A restaurant makes the exchange easy to remember:

  • The browser is the customer.
  • The request is the order.
  • The server is the kitchen.
  • The response is the meal.

You place an order, the kitchen reads it, prepares the dish and sends it out. The web works on the same pattern: the browser asks, the server does the work, and the result comes back. Each response also includes a status code, such as 200 for success or 404 when the page does not exist, which tells the browser how to treat what it received.

Stage 4: Turning files into a page

Having the files is not the same as showing a page. The browser still has to interpret them and combine them into what you see, and each of the three core web languages has a distinct role.

HTML provides the structure

HTML describes what is on the page and how it is organized: headings, paragraphs, buttons, images, links and so on. It is the skeleton. The browser parses it into the DOM (Document Object Model), a tree of elements that the rest of the process works from.

CSS controls the appearance

CSS decides how that structure looks: colours, fonts, spacing, layout and sizes. If HTML is the skeleton, CSS is everything that gives it a visual form. The browser parses stylesheets into their own structure and matches each rule to the elements it applies to.

JavaScript adds behaviour

JavaScript makes the page interactive: responding to button clicks, running animations, loading and updating content without a full reload, and much more. Scripts can read and change the DOM and styles, which is why a page can transform after it first appears.

Putting it together

With structure and styles combined, the browser calculates where every element goes (layout) and then draws the result (paint). By default, a plain <script> tag pauses HTML parsing while the script downloads and runs, which is one reason performance advice often recommends the defer or async attributes.

The whole journey in order

Stringing the stages together:

  1. You enter a website address.
  2. DNS translates the name into an IP address.
  3. The browser connects to the server and sends a request.
  4. The server receives and processes the request.
  5. The server sends back a response.
  6. The browser receives HTML and requests the CSS, JavaScript, images and other data it references.
  7. The browser parses and combines those resources.
  8. The finished page appears on your screen.

On a fast connection, much of this happens in a fraction of a second, which is why it feels like pressing Enter simply makes the page appear.

Why this model is worth having

Knowing this sequence ties together concepts that are usually taught separately: browsers, DNS, servers, HTML, CSS and JavaScript. It also gives you a place to put new knowledge. When you later learn about APIs, you will recognise them as more request-and-response exchanges. When you study backend work, you will know it lives on the server side of stage 3. When you look into front-end performance, you will know it is mostly about making stages 3 and 4 faster.

It also helps with debugging. A "site not found" error points to stage 1, a timeout or connection error to stage 2, a 500 status to the server in stage 3, and a page that loads but looks broken to CSS or JavaScript in stage 4.

Key takeaways

  • DNS maps human-friendly names to IP addresses, with caching at several layers.
  • The browser opens a connection, secured with TLS for HTTPS, and sends an HTTP request.
  • The server replies with HTML, which in turn references CSS, JavaScript, images and other resources.
  • HTML becomes the DOM for structure, CSS styles it, and JavaScript adds behaviour before the browser lays out and paints the page.
  • Each stage fails in its own recognisable way, which makes this model a practical debugging tool as well as a learning aid.