Hilbert Curve Explorer illustration

Hilbert Curve Explorer

A space-filling curve is a single continuous line that visits every point of a square. This explorer draws the Hilbert curve order by order: each step replaces the curve with four half-size copies, glued by three joints, doubling the resolution. Animate the drawing to see the snake wind through every cell, and colour it by position to see why Hilbert order is used in databases and mapping: points close along the curve stay close in the plane.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • In the limit the curve passes through every point of the square — a 1D line with Hausdorff dimension 2.
  • Hilbert order preserves locality, which is why databases and map tiles use it to linearise 2D data.
  • Order n visits 4ⁿ cells; each order doubles the grid resolution in both directions.
  • Runs 100% in your browser — simulations are computed locally on your device.