Tools: Show Hn: I Built A Small Browser Engine From Scratch In C++ 2026
Hello, I'm a korean high school senior (Grade 12) planning to major in Computer Science.
I wanted to understand not just how to use technology, but how it works internally. I've built several websites with HTML, CSS, and JavaScript, but I never really understood how the browser executing this code actually works.
To answer this question, I spent about 8 weeks building a browser engine from scratch.
C++ was entirely new to me, and I struggled with countless bugs, but I eventually completed a small browser that can parse HTML, apply CSS, and render images. While not perfect, it was sufficient to understand the core principles of how browsers work.
The GUI window will appear. You can test rendering by opening HTML files from the test_html_files directory.
Real browsers follow a 5-stage pipeline to render HTML to screen:
The first step breaks down HTML text into small units (tokens) that the parser can understand.
Organize tokens into a hierarchical tree structure (DOM Tree).
HTML_PARSER (include/html/html_parser.h, src/html/html_parser.cpp)
Goal: Parse CSS rules and apply styles to each node
Source: HackerNews