Skip to main content

Command Palette

Search for a command to run...

How a Browser Works: A Beginner-Friendly Guide to Browser Internals

Understand the Process After Typing a URL and Pressing Enter

Updated
4 min read
How a Browser Works: A Beginner-Friendly Guide to Browser Internals

🧑 Overview

Most of us use a browser every single day. We open a tab, type something like example.com, and a website appears almost instantly. It feels simple — almost magical.

But a browser is not just a “website opener.” It is actually a coordinated system of small programs working together, each doing a very specific job, very quickly, and in a strict order.

Think of a browser less like a single app… and more like a team in a restaurant kitchen. You place an order (the URL), and different specialists handle ingredients, cooking, plating, and serving — all before the food reaches your table (your screen).

Let’s walk through that story.


1. The Main Parts of a Browser (High Level)

A browser has four big responsibilities:

1) User Interface (UI) This is the part you see:

  • Address bar

  • Back/forward buttons

  • Tabs

  • Bookmarks

The UI is simply how you talk to the browser.

2) Browser Engine The coordinator. It decides what should happen next and tells other components when to work.

3) Rendering Engine The artist. It takes website code and turns it into actual visuals — text, images, layout.

4) Networking + JavaScript Engine

  • Networking fetches files from the internet

  • JavaScript engine runs scripts that make pages interactive

So the UI listens to you, the browser engine manages tasks, networking fetches content, and the rendering engine draws the page.


2. Step One: Fetching the Website

You type a URL and press Enter.

The browser now asks:

“Where is this website located on the internet?”

Using networking protocols (mainly HTTP/HTTPS), it sends a request to a server somewhere in the world. The server responds with files — primarily:

  • HTML (structure)

  • CSS (style)

  • JavaScript (behavior)

The first file received is almost always HTML. This file is not a visual page. It is more like instructions.


3. HTML Parsing → Creating the DOM

The browser now reads the HTML.

This process is called parsing — breaking text into meaningful pieces.

Example:

<h1>Hello</h1>
<p>This is a page</p>

The browser doesn’t see “text.” It sees a structure.

It converts HTML into something called the DOM (Document Object Model).

Imagine a family tree:

  • The page is the parent

  • Sections are children

  • Elements like <p> and <h1> are nodes

So the browser creates a tree-like map of the page. This map is the DOM.


4. CSS Parsing → Creating the CSSOM

Next, the browser reads the CSS file.

CSS tells:

  • colors

  • spacing

  • font sizes

  • positioning

The browser parses CSS into another structure called the CSSOM (CSS Object Model).

If the DOM is what things are, the CSSOM is how things should look.


5. DOM + CSSOM → The Render Tree

Now comes the important merge.

The browser combines:

  • DOM (structure)

  • CSSOM (style)

This creates the Render Tree.

Important detail: The render tree only includes visible elements. For example, elements with display: none are ignored — they exist in the DOM but are not drawn.


6. Layout (Reflow), Paint, and Display

The browser is finally ready to draw.

Layout (also called Reflow)

The browser calculates:

  • positions

  • widths

  • heights

It decides exactly where every element should appear on the screen.

Paint

Now it fills pixels:

  • text color

  • backgrounds

  • borders

  • shadows

Display (Compositing)

Layers are combined and sent to your screen. This is when you actually see the page.

So what felt instant actually involved:

  1. Requesting files

  2. Reading HTML

  3. Building a tree

  4. Reading CSS

  5. Merging structures

  6. Calculating layout

  7. Painting pixels

All of this typically happens in under a second.


7. A Simple Idea of Parsing

Parsing sounds complicated, but you already understand it.

Consider:

2 + 3 × 4

You don’t read it left-to-right as: (2 + 3) × 4

Your brain forms a structure:

  • Multiply 3 and 4

  • Then add 2

Your brain builds a tree of meaning. The browser does the same with HTML — converting text into relationships.

Parsing is simply turning raw text into organized meaning.


8. The Full Flow (From URL to Pixels)

Here is the full journey:

  1. You type a URL

  2. Browser sends network request

  3. Server returns HTML

  4. Browser parses HTML → DOM

  5. Browser fetches CSS

  6. CSS parsed → CSSOM

  7. DOM + CSSOM → Render Tree

  8. Layout calculation

  9. Paint pixels

  10. Page appears on screen


🎯 Final thoughts

After you press Enter on a URL, the browser doesn’t simply “open a website.” It runs a precise pipeline: it requests files from a server, parses HTML into the DOM (structure), parses CSS into the CSSOM (style), combines them into a render tree, calculates layout, paints pixels, and finally composites the page to your screen.

In other words, a browser is a real-time interpreter and graphics renderer that transforms code (HTML, CSS, JavaScript) into a visible, interactive webpage — all in a fraction of a second.