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

What Happens After You Type a URL and Press Enter?

https://beehiiv-images-production.s3.amazonaws.com/uploads/asset/file/e525ea1b-f275-45e2-bd83-cb6725583b22/bb4ed1cf-6143-48b5-b9af-60f65d921e68_500x339.png?t=1651893384

https://www.researchgate.net/publication/332093270/figure/fig1/AS%3A742069534466048%401553934572252/The-main-components-of-a-web-browser.ppm

https://www.researchgate.net/publication/325076604/figure/fig1/AS%3A625081613053952%401526042478356/Browser-Reference-Architecture-The-User-Interface-component-provides-the-methods-with.png

When you type a URL like www.example.com and press Enter, something incredible happens behind the scenes. In less than a second, your browser contacts servers across the world, downloads files, builds structures in memory, calculates layouts, and finally paints pixels on your screen.

A browser is not just a tool that “opens websites.” It is a complex software system made up of multiple components working together like a team.

Let’s understand this step by step — in a simple, story-driven way.


What Is a Browser, Really?

A browser is a software application that:

  • Requests web content from servers

  • Interprets HTML, CSS, and JavaScript

  • Converts them into visual pages

  • Displays them on your screen

Popular browsers include Google Chrome (Chromium engine) and Mozilla Firefox (Gecko engine). While their internal implementations differ slightly, the overall process is similar.

You can think of a browser as a translator and painter. It reads web languages (HTML, CSS, JS) and turns them into something humans can see and interact with.


Main Parts of a Browser (High-Level View)

A browser has several major components:

  • User Interface (UI)

  • Browser Engine

  • Rendering Engine

  • Networking Component

  • JavaScript Engine

Each one plays a specific role in turning code into visuals.


User Interface (UI)

The user interface includes:

  • Address bar

  • Back/forward buttons

  • Tabs

  • Bookmark bar

This is the part you interact with directly. When you type a URL, the UI sends that request to the browser engine to begin processing.

Think of the UI as the control panel of the browser.


Browser Engine vs Rendering Engine

The Browser Engine acts as a coordinator. It connects the user interface with the rendering engine.

The Rendering Engine is responsible for displaying content on the screen. It takes HTML and CSS and converts them into visible content.

In simple terms:

  • Browser Engine → Manager

  • Rendering Engine → Builder and Painter

The rendering engine does the heavy lifting.


Networking: Fetching HTML, CSS, and JS

https://images.marketpath.com/9dda7041-2870-4a96-bf1e-dd8342e86e7c/image/8b3c4351-e344-4cf9-99a4-31559d3a4262/webserverrequest.png

https://www.researchgate.net/publication/369358390/figure/fig1/AS%3A11431281127810255%401679180216268/HTTP-request-and-response-flow.png

https://webperf.tips/static/0085f9f18930b6e5b069b04bfbf33c07/906b5/ProcessModel02.png

Once you press Enter:

  1. The browser sends an HTTP request to the server.

  2. The server responds with HTML.

  3. The browser may then request additional files like CSS, JavaScript, and images.

This process is handled by the browser’s networking layer.

Think of this like ordering food:

  • You place an order (request)

  • The restaurant sends your food (response)


HTML Parsing and DOM Creation

https://www.w3schools.com/js/pic_htmltree.gif

https://www.researchgate.net/publication/221417012/figure/fig2/AS%3A669043992322053%401536523926785/Dom-Tree-of-An-Example-Web-Page.png

https://i.sstatic.net/bWJbp.png

When the browser receives HTML, it doesn’t display it immediately. First, it parses it.

Parsing means breaking something into meaningful pieces.

For example:
If you see:
2 + 3 × 4

Your brain builds a structure to understand it:

  • Multiply first

  • Then add

Similarly, the browser reads HTML and builds a structure called the DOM (Document Object Model).

The DOM is like a tree:

  • <html> is the root

  • <body> is a branch

  • <div>, <p>, <h1> are smaller branches

The browser turns HTML text into a tree structure in memory.


CSS Parsing and CSSOM Creation

https://web.dev/static/articles/critical-rendering-path/render-tree-construction/image/dom-cssom-are-combined-8de5805b2061e.png

https://developer.chrome.com/static/blog/devtools-css-value-parsing/images/hsl-ast-phase1.png

Next, the browser parses CSS.

Just like HTML creates the DOM, CSS creates something called the CSSOM (CSS Object Model).

If DOM is the structure of the house,
CSSOM is the styling instructions:

  • Colors

  • Fonts

  • Sizes

  • Positions

CSS rules are organized into another tree-like structure.


DOM + CSSOM = Render Tree

https://web.dev/static/articles/critical-rendering-path/render-tree-construction/image/dom-cssom-are-combined-8de5805b2061e.png

https://media2.dev.to/dynamic/image/width%3D800%2Cheight%3D%2Cfit%3Dscale-down%2Cgravity%3Dauto%2Cformat%3Dauto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F56cdizmlhcvpwgjx55k7.png

https://webperf.tips/static/d77eb220c5dd10181dc361c4ff0051da/906b5/BrowserRenderingPipeline17.png

Now the magic happens.

The browser combines:

  • DOM (structure)

  • CSSOM (style rules)

This combination forms the Render Tree.

The Render Tree contains only visible elements and includes styling information.

It answers:

  • What should be displayed?

  • How should it look?


Layout (Reflow), Painting, and Display

https://www.webperf.tips/static/6c2b05dff8f3a74701a9189098f00a39/e1697/LayoutThrashing03.png

https://web.dev/static/articles/critical-rendering-path/render-tree-construction/image/dom-cssom-are-combined-8de5805b2061e.png

https://webperf.tips/static/d77eb220c5dd10181dc361c4ff0051da/906b5/BrowserRenderingPipeline17.png

After creating the Render Tree, the browser performs:

Layout (Reflow)

It calculates:

  • Exact positions

  • Widths

  • Heights

This determines where every element should appear on the page.

Painting

The browser fills in:

  • Colors

  • Borders

  • Text

  • Images

Display

Finally, everything is converted into pixels and shown on your screen.

From URL to pixels — that’s the full journey.


Full Flow Summary

The entire process looks like this:

  1. You type a URL

  2. Browser sends HTTP request

  3. Server sends HTML

  4. HTML → DOM

  5. CSS → CSSOM

  6. DOM + CSSOM → Render Tree

  7. Layout → Paint → Display

All of this happens in milliseconds.