Web Browser Engineering

Pavel Panchekha & Chris Harrelson

Twitter · Blog · Patreon · Discussions

Web browsers are ubiquitous, but how do they work? This book explains, building a basic but complete web browser, from networking to JavaScript, in a thousand lines of Python.

Get an email every time we publish a new chapter:

Adding your email to the list...
Success! You'll receive a welcome email shortly.
Error! Something seems to have gone wrong.

Follow this book’s blog or Twitter for updates. You can also talk about the book with others in our discussion forum.

If you are enjoying the book, consider supporting us on Patreon.


  1. Preface
  2. Browsers and the Web
  3. History of the Web

Part 1: Drawing Graphics

  1. Downloading Web Pages
    URLs and HTTP requests
  2. Drawing to the Screen
    Creating windows and drawing to a canvas
  3. Formatting Text
    Word wrapping and line spacing

Part 2: Viewing Documents

  1. Constructing a Document Tree
    Parsing and fixing HTML
  2. Laying Out Pages
    Inline and block layout, plus the box model
  3. Applying User Styles
    Parsing and applying CSS
  4. Handling Buttons and Links
    Hyperlinks and browser chrome

Part 3: Running Applications

  1. Sending Information to Servers
    Form submission and web servers
  2. Running Interactive Scripts
    Changing the DOM and reacting to events
  3. Keeping Data Private
    Cookies and logins, XSS and CSRF

Part 4: Modern Browsers

  1. Adding Visual Effects
    Filters and transformations
  2. Scheduling and Threading
    The Rendering Event Loop and Pipeline
  3. Saving Partial Layouts
    Two-phase layout and fast rendering


  1. What Wasn’t Covered

  2. A Changing Landscape


  1. Glossary
  2. Bibliography
  3. About the Authors
  4. List of courses taught from this book