Hilbert Curve

Generate, interact with, and export the continuous Hilbert space-filling fractal curve online. Supports custom recursion orders (1 to 7), canvas pan/zoom touch gestures, and clean SVG and PNG exports.

Private • In-browser processing • Zero server uploads

Interactive workspace loading...

How to Use Hilbert Curve

1
Select Recursion Order
Use the order slider or input field to choose the recursion depth from 1 to 7.
2
Customize Styling
Pick your curve stroke color, background color, and stroke width.
3
Pan and Zoom
Touch or drag on the canvas to inspect fine quadrant structures.
4
Export SVG or PNG
Click Download or Copy to grab the vector SVG code or high-res PNG graphic.

Key Features

Interactive Recursion Orders
Generate orders 1 through 7 with instant client-side rendering.
Dual Format Export
Download pixel-crisp raster PNG or infinitely scalable vector SVG markup.
Touch & Pan Support
Smooth touch drag and pinch gesture interactions for mobile and desktop displays.
Safe Depth Cap
Enforces strict recursion limits to guarantee 60 FPS performance without thread locking.

Common Use Cases

  • Spatial indexing and multi-dimensional database indexing (geohashing, R-trees).
  • Computer graphics, image dithering, and locality-preserving color quantization.
  • Algorithmic art, mathematical visualization, and educational demonstrations.
  • CNC laser routing, pen plotters, and single-stroke continuous vector paths.

Frequently Asked Questions

The Hilbert curve is a continuous fractal space-filling curve first described by German mathematician David Hilbert in 1891. Its Hausdorff dimension is 2, completely filling the 2D unit square as the order approaches infinity.

An order $n$ Hilbert curve contains exactly $4^n$ vertices and $4^n - 1$ line segments. Order 1 has 4 points, Order 4 has 256 points, and Order 7 has 16,384 points.

Because vertex count grows quadruply ($4^n$), order 8 generates 65,536 points and order 9 would generate 262,144 points. Capping at 7 guarantees instantaneous rendering without freezing browser UI.