Skip to main content

Command Palette

Search for a command to run...

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

Published
4 min read

You type a URL. You press Enter. A website appears. But what actually just happened?

What did your browser do between the moment you pressed Enter and the moment the page appeared on your screen? Let’s break it down step by step visually, simply.

What Is a Browser, Really?

Most beginners say:

“A browser opens websites.” ,That’s true but incomplete. A browser is actually:

A complex software system that fetches, interprets, processes, and renders web content into something you can see and interact with.

It doesn’t just “open” a website.

It:

  • Requests data from servers

  • Parses HTML

  • Applies CSS

  • Executes JavaScript

  • Builds visual layout

  • Paints pixels on your screen

All in milliseconds.

High-Level Browser Architecture

Think of a browser as multiple components working together.

Let’s understand each one simply.

User Interface (UI)

This is the part where we interact with.

It includes:

  • Address bar

  • Back/Forward buttons

  • Tabs

  • Refresh button

  • Bookmark bar

This is just the visible shell of the browser. It does not render websites.

Browser Engine vs Rendering Engine

Browser Engine

Acts as a coordinator.

It:

  • Connects UI with rendering engine

  • Manages navigation

  • Controls page loading

Think of it as the manager.

Rendering Engine

This is the part that:

  • Parses HTML

  • Parses CSS

  • Builds page structure

  • Paints the content

Think of it as the artist that draws the webpage.

Examples :

  • Chromium uses Blink

  • Firefox uses Gecko

Networking

The Networking component:

  • Sends HTTP requests

  • Receives HTML, CSS, JS, images

  • Handles connections

Without networking, the browser cannot fetch resources from servers.

JavaScript Interpreter (JS Engine)

This component:

  • Executes JavaScript code

  • Modifies the DOM

  • Handles events

  • Updates the page dynamically

Examples :

  • V8 (Chrome)

  • SpiderMonkey (Firefox)

UI Backend

The UI Backend:

  • Draws basic widgets

  • Handles OS-level rendering

  • Manages buttons, dropdowns, input elements

It communicates with the operating system.

Disk API

The Disk API interacts with:

  • Local storage

  • Cookies

  • Cache

  • Browser history

  • IndexedDB

It allows the browser to store and retrieve data locally.

What Happens After HTML Is Received?

The browser doesn’t display raw HTML. It must understand it. This process is called parsing.

What is Parsing?

Imagine this math expression:

3+5×2

The computer doesn’t just read it as text. It breaks it into parts: Then it builds a structure to understand order.

Parsing means: Breaking text into meaningful structure. The browser does the same with HTML and CSS.

HTML Parsing → DOM Creation

When HTML is received: The rendering engine parses it and builds a DOM. DOM = Document Object Model. It is a tree structure.

Example HTML:

<body>
  <h1>Hello</h1>
  <p>Welcome</p>
</body>

Becomes:

This tree is the DOM. The DOM represents the structure of the page.

HTML → DOM Flow

CSS Parsing → CSSOM Creation

Next, the browser processes CSS. CSS is also parsed.

Example CSS:

h1 {
  color: red;
}

The browser creates a structure called: CSSOM = CSS Object Model. It represents styling rules in a tree-like structure.

CSS → CSSOM→ DOM Flow

Now the browser combine HTML and CSS to content Sink and combine DOM created. That DOM goes to Frame Constructor

To create: The Render Tree, the render tree contains only visible elements.

It includes:

  • Structure

  • Styling

  • Layout rules

Layout (Reflow)

Now the browser calculates:

  • Width

  • Height

  • Position

  • Margins

  • Spacing

This process is called: Layout (or Reflow)

It answers: “Where should each element appear on the screen?”

Painting

After layout:

The browser paints pixels.

It fills:

  • Colors

  • Borders

  • Text

  • Images

This is called: Paint

Display

Finally: The painted result is displayed on your screen. That is the complete journey.

Full Browser Flow: From URL to Pixels on Screen

This diagram shows the complete journey of a webpage, starting from typing a URL to rendering pixels on the screen.