How Mandelbrot.site Was Built

Mandelbrot.site is a web-based viewer for exploring the Mandelbrot set by panning, zooming, changing colors, and saving interesting views. The goal is to make a mathematically rich object feel as immediate as using an online map.

The site is built with Rust, WebAssembly, TypeScript, and Leaflet.js. Leaflet is usually used for geographic maps, but it works well here because the Mandelbrot set can also be explored as a tiled, zoomable surface. Instead of requesting map tiles from a server, the app generates fractal tiles in the browser.

What You Can Do

The viewer includes the controls people expect from an exploratory tool, plus some that reward a closer look:

How It Works

The calculation-heavy part of the viewer is written in Rust and compiled to WebAssembly. This keeps the fractal rendering fast while still running inside the browser. The user interface is written in TypeScript, which helps keep the application predictable as features are added.

Generating a Mandelbrot image can take real work, especially at deeper zoom levels. To keep the page responsive, the app uses Web Workers through threads.js. These workers calculate tiles away from the main browser thread, so panning and zooming can stay smooth while new imagery is being produced.

When a tile is needed, the app queues the job, sends the tile bounds to the WebAssembly module, and receives pixel data back for display. The work is split into small pieces so the viewer can fill in the screen progressively instead of waiting for one large render to finish.

One useful optimization is "rectangle checking." When a region's boundary can be confirmed as inside the Mandelbrot set, the app can fill it without testing every single point. That saves time in large solid regions, where extra calculation would not change the final image.

Zooming Past Floating Point

Ordinary 64-bit numbers run out of precision surprisingly quickly: deep enough into a zoom, neighboring pixels become mathematically identical and the image dissolves into blocks. Mandelbrot.site keeps going by using perturbation theory: it computes one point per view with extremely high precision, then describes every other pixel as a tiny offset from that reference. The offsets are small enough for fast hardware arithmetic, so deep views stay quick even though the underlying coordinates have hundreds of digits.

Making It Fast

Performance work on the site is measured, not guessed. A benchmark harness runs candidate builds in a real copy of Chrome against a corpus of views, including views real users actually visited, and compares them against the current build. A change only ships if it is measurably faster and produces exactly the same pixels, and every experiment is logged so the same question never gets investigated twice. That process has paid for itself: the renderer now uses SIMD instructions to compute several pixels at once, and browsers that support the newest WebAssembly features automatically receive an even faster build.

Conclusion

Mandelbrot.site combines a familiar map-style interface with in-browser computation. Rust and WebAssembly handle the demanding calculations, while TypeScript and Leaflet provide the interactive experience around them.

The project will continue to improve, but its core idea is already in place: make fractal exploration fast, visual, and easy to share.