Generate a Hilbert Curve

Draw a Hilbert space-filling curve for a chosen order

Order n visits 2^(2n) cells. Maximum order 8 (65536 points).

Examples:

  • Order 1 → 4 points (simple U shape)
  • Order 3 → 64 points
  • Order 6 → 4096 points (dense space-filling look)

Related tools

What is a Hilbert Curve?

A Hilbert curve is a continuous fractal space-filling curve that visits every cell of a square grid while preserving locality better than a simple scanline order.

Why Generate It?

  • Education: Show recursive space-filling constructions
  • Algorithms: Illustrate locality-preserving indexes
  • Art: Produce dense geometric patterns

How This Tool Works

Pick an order n. The tool maps each index 0…2^(2n)−1 to a grid coordinate with the classic Hilbert rotation algorithm and strokes the path on a canvas in your browser.

Related Tools

  • Visualize an L-System: Turtle-graphics fractals
  • Generate a Sierpinski Triangle: Triangle gasket fractal
  • Draw Pascal's Triangle: Binomial coefficient arrays