AI & Tech Daily

AI & Tech Daily

How Browsers Work: Rendering, Layout, and Painting (Interview Edition)

πŸš€ For JavaScript developers preparing for frontend interviews β€” this post is part of a paid series focused on real-world technical questions and concepts.

Mikita Aliaksandrovich's avatar
Mikita Aliaksandrovich
Aug 01, 2025
βˆ™ Paid

πŸ“‹ What You'll Learn in This Post

  • What happens when you type a URL in the browser

  • How rendering works under the hood (DOM, CSSOM, render tree)

  • What triggers reflows and repaints

  • Most common performance interview questions

  • Optimized React examples

  • Real answers you can give in interviews

  • Soft skills questions & AI usage tips


πŸ’¬ Why This Post?

Over the past 8 years of interviews β€” both as a candidate and as an interviewer β€” I've seen the same core questions repeat again and again:

  • "What happens when you type a URL?"

  • "Explain the rendering pipeline."

  • "What causes layout shifts or reflows?"

And I get it β€” I used to struggle with these questions too.

But now I want to make it easier for others by sharing everything I’ve learned in a single place. If you’ve ever wished someone would just explain how browsers work in simple, interview-ready terms β€” this post is for you.

πŸ“© Subscribe now to unlock the full series and get notified when the next deep-dive article drops.


🌐 What Happens When You Type a URL? (Deep Dive)

This question comes up in almost every interview β€” and it's where many candidates start to stumble because they stop at β€œit sends a request.”

Here’s a more complete, structured version you can use or adapt:

Step-by-Step Breakdown:

  1. DNS Resolution

    • The browser checks cache β†’ OS cache β†’ router cache β†’ DNS server to resolve the domain name to an IP address.

    • You can explain DNS caching layers if asked for details.

  2. TCP Handshake + TLS (if HTTPS)

    • TCP connection is established (3-way handshake).

    • If HTTPS, the browser and server negotiate TLS to encrypt communication.

  3. HTTP Request

    • Typically a GET request is made for the main document.

    • You can mention headers (like cookies, auth, user-agent) if asked.

  4. Server Responds

    • Returns an HTML document with a 200 OK response.

  5. Browser Starts Rendering

    • Starts building the DOM tree from HTML.

    • Requests additional resources: CSS, JS, fonts, images.

    • CSS β†’ CSSOM tree

    • DOM + CSSOM β†’ Render Tree

    • Layout β†’ Paint β†’ Composite

  6. JavaScript Execution

    • Scripts might block rendering (unless async or defer).

    • JS can manipulate the DOM, trigger reflows.

  7. Final Paint

    • Pixels are drawn on the screen.

βœ… Pro Tip (for interviews): Mention preloading, caching strategies, and how SPAs may alter this process via service workers or client-side routing.

πŸ“© Want more tips like this? Subscribe now to get full access to the series.

User's avatar

Continue reading this post for free, courtesy of Mikita Aliaksandrovich.

Or purchase a paid subscription.
Β© 2026 Mikita Aliaksandrovich Β· Privacy βˆ™ Terms βˆ™ Collection notice
Start your SubstackGet the app
Substack is the home for great culture