Visualizations
116 / 500

116 · Fractals

Mandelbrot Zoom

An endless dive into the Mandelbrot set, 10^31 times deep.

The camera dives into Seahorse Valley toward a tiny copy of the whole set, more than 10^31 times deeper than the first view. Plain floating point runs out of precision around a zoom of 10^14, so the program computes one reference orbit with BigInt arithmetic and tracks every other pixel as a small difference from it, a technique called perturbation, rebasing pixels onto the reference whenever they drift so the image never glitches. Bilinear approximation lets pixels skip thousands of iterations at once. Keyframes render at each doubling of the zoom and blend into one another, while smooth coloring and a soft relief keep the bands silky.

Try it. Click anywhere to dive toward that point (clicks snap to the nearest detail). Scroll to zoom in or out.

  • Perturbation theory
  • Arbitrary precision arithmetic
  • Smooth escape-time coloring

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build an endless Mandelbrot zoom with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Render into an offscreen canvas at half the window size with ImageData and draw it scaled up.
- For each pixel, iterate z = z^2 + c up to an iteration limit and record when |z| passes a large bailout radius. Use the smooth count n + 1 - log2(log|z|) and map it through a palette of four or five colors you blend between, with points that never escape in near-black.
- Zoom continuously toward a point on the boundary, such as -0.7436438870371587 + 0.1318259042053120i in Seahorse Valley, shrinking the view by a few percent per frame and raising the iteration limit as you go deeper.
- To keep it smooth, render each new image a band of rows per frame, and while it renders, keep drawing the last finished image scaled up to match the current zoom.

Once that works, make it beautiful:
- Plain doubles run out of precision around a zoom of 10^13. Push past it with perturbation: compute one reference orbit at the zoom center with BigInt fixed-point arithmetic, store it as doubles, and iterate every pixel as a small difference from it: delta = 2 * Z * delta + delta^2 + dc.
- When a pixel's |z| becomes smaller than its delta, restart it from the beginning of the reference orbit with delta = z. This rebasing trick avoids the glitches perturbation is known for.
- Cycle the palette slowly with depth, light the escape count like a height map for a soft relief, and show the magnification in a corner.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as clicking to choose where to dive, bilinear approximation to skip iterations, or finding a deep minibrot with Newton's method to end the zoom on.
PreviousTearable ClothA sheet of Verlet points and springs that sags, swings and rips. NextPlotter LandscapeA mountain range inked stroke by stroke, with exact floating-horizon hidden lines.

Related visualizations

  • Julia SetFractals A fractal that reshapes itself as its complex constant wanders.
  • BuddhabrotFractals Escaping Mandelbrot orbits stacked into a deep-space nebula by Metropolis-Hastings.
  • MandelbulbFractals A 3D fractal, ray marched pixel by pixel on the CPU.
  • Sound of MandelbrotFractals Hover the Mandelbrot set to see and hear orbits: each bulb's period plays as a loop.
  • Menger FlythroughFractals An endless dive into a sunlit Menger sponge that never runs out of smaller holes.
  • Apollonian GasketFractals An endless packing of kissing circles, each engraved with its exact integer curvature.
  • Newton BasinsFractals Drag the roots of a polynomial and Newton's method paints a fractal.
  • Road to ChaosMath The logistic map's bifurcations, Mandelbrot bulbs and a cobweb, linked in one picture.
  • Droste SpiralType and image Escher's Print Gallery effect: a painted harbor town that spirals into itself forever.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs