(yes, it's a browser built from scratch in rust)
a minimal web browser that renders html, parses css, executes javascript.
Screen.Recording.2025-12-11.at.8.38.11.PM.mov
it's a custom web browser written entirely in rust. no webkit, no chromium, no gecko. just pure rust rendering HTML to pixels on your screen. it tokenizes HTML, builds a DOM tree, computes styles with CSS specificity, performs layout calculations, and paints everything to a framebuffer.
- html parsing: custom tokenizer and DOM tree builder with proper tag nesting.
- css styling: supports selectors, specificity, colors, font sizes, padding, and more.
- javascript execution: runs scripts via the boa engine (console.log, document.write, etc).
- clickable links: navigate between pages by clicking
;a>tags. - scrolling: smooth mouse wheel scrolling through long pages.
- self-closing tags: properly handles
,g/>
, and other void elements.
r/> - url bar: type any url and hit enter to navigate.
i wanted to understand how browsers actually work under the hood. parsing, rendering, layout—all of it. also, most "build a browser" tutorials stop at toy examples that can't load real websites.
so, i made this :D
# clone the repo
git clone https://github.com/aryan-madan/Photon-Browser
cd photon-browser
# build release version
cargo build --release
# run it
./target/release/photon_browserror you can download the .exe from releases tab
- fetch → downloads html via http
- tokenize → breaks html into tags and text
- parse → builds a tree of nodes (the dom)
- style → applies css rules with proper specificity
- layout → calculates position and size of boxes
- paint → rasterizes text and backgrounds to pixels
- display → presents the framebuffer to the window
- large pages can be slow (no gpu acceleration)
- some websites with complex css won't render correctly
- javascript dom manipulation is limited
- no https certificate validation
pull requests welcome! this is a learning project, so don't expect production-quality code. but if you want to add features or fix bugs, go for it.
- inspired by linus lee's Browser.engineering
- css parsing based on mozilla's servo research
- javascript via boa engine
MIT - do whatever you want with it
enjoy (._.)/