EditSafely

Generate a Peano Curve

Draw a Peano space-filling fractal. Runs entirely in your browser, so your data never leaves your device.

Output

The result appears here as you type.

Options

How to use Generate a Peano Curve

  1. 1. Choose the curve's order. Set Iterations to pick the grid size. A 3rd-order curve visits every cell of a 27x27 grid; each additional order triples the grid dimension in each direction.
  2. 2. Size the canvas. Set Width (px) and Height (px) to fit the serpentine path. A square canvas matches the curve's square grid structure and keeps the winding pattern legible.
  3. 3. Pick colors and line width. Choose Line color, Background color and Line width depending on whether you want to trace the serpentine path visually or show the overall filled pattern at a glance.
  4. 4. Review the rendered curve. The tool draws a single serpentine line visiting every cell of the grid in order, as an SVG. Save it once the order and colors look right.

When to use Generate a Peano Curve

Generate a Peano Curve draws Giuseppe Peano's original space-filling curve, historically the first curve discovered that passes through every point of a square while remaining continuous. It predates the Hilbert curve and uses a 3-way subdivision instead of a 4-way one.

  • Teaching the history of space-filling curves. The Peano curve was the first discovered space-filling curve, published in 1890, and rendering it alongside the later Hilbert curve helps place both in historical context.
  • Comparing 3-way and 4-way curve subdivisions. Unlike the Hilbert curve's 2x2 subdivision, the Peano curve splits each cell into a 3x3 grid, and seeing both side by side clarifies how the subdivision scheme changes the curve's shape.
  • Explaining continuity and dimension paradoxes. The Peano curve is a classic example used to introduce the surprising fact that a one-dimensional curve can be continuous and still fill a two-dimensional region.
  • Producing a figure for a topology or analysis course. A lecture on continuous surjections from an interval onto a square benefits from a correctly rendered Peano curve at a specific order as a supporting figure.

Examples

A 3rd-order Peano curve

Output

An SVG drawing of a single serpentine line visiting every cell of a 27x27 grid.

About the Generate a Peano Curve tool

Generate a Peano Curve runs as plain JavaScript in your browser tab, with no server behind it. Draw a Peano space-filling fractal. Whatever you put in stays on your device from start to finish.

The tool is part of EditSafely's Math Tools section, 234 single-purpose utilities built around the same idea: open the page, get the result, keep your data to yourself.

You can shape the output with 6 settings, including Iterations, Width (px), Height (px) and Line color, and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.

That local-first design has practical benefits beyond privacy. The tool keeps working on a flaky connection once the page has loaded, results are instant because nothing round-trips to a server, and it is safe to use with confidential material.

Frequently asked questions

Does Generate a Peano Curve cost anything?

Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.

Does the generator send anything to a server?

No data leaves your device. The whole tool is JavaScript that runs inside your browser tab, so there is no upload, no server-side processing and no log of what you did. If you disconnect from the internet after the page loads, it keeps working.

How do I get a different result?

Run the generator again. Each run is computed fresh on your device, and any options you change are applied to the next result immediately.

Do I need to sign up or install anything?

Nothing to install and no account needed. Open the page in any up-to-date browser, including on a phone or tablet, and the tool is ready.

Can I save what the tool produces?

Yes. Use the download or copy controls in the output panel to keep the rendered result once it looks the way you want.

Related tools

All Math Tools