Tools

Home
Password GeneratorLorem IpsumCoin FlipperRandom StringToken GeneratorRandom Color

Peano Fractal Generator

Draw the Peano space-filling curve with custom iterations, colors, and line width

Your files never leave your browser
Ready·Canvas API rendering

Generate a Peano space-filling curve in seconds — pick iteration depth (1 to 5), set your colors and stroke width, then hit Draw. The recursive 3x3 subdivision math is handled for you, and the result exports as a clean PNG with no watermark. And everything runs in your browser. Nothing gets uploaded.

How It Works

Set Iterations & Colors
→
Recursive Subdivision
→
Canvas Renders Curve

The algorithm splits the canvas into a 3x3 grid, then splits each cell into another 3x3 grid, and keeps going for as many iterations as you set. At each level, it connects the centers of those sub-squares in a specific order that guarantees a continuous path — no jumps, no gaps. The final path gets drawn stroke-by-stroke onto an HTML5 canvas element.

Examples

Quick Classroom Demo

A math teacher needs a visual to explain space-filling curves in under a minute.

INPUT
Iterations: 2 Line color: #000000 Background: #ffffff Line width: 3
OUTPUT
81-segment Peano curve on white background. Clean enough for slides.

Poster-Quality Generative Art

A designer wants a high-detail fractal pattern for a 24x36 print. They crank the iteration up and pick brand colors for a client project.

INPUT
Iterations: 5 Line color: #e11d48 Background: #0f172a Line width: 1
OUTPUT
59,049-segment curve in rose-red on dark navy. Fills the canvas almost completely at this depth.

Comparing Iteration Levels Side by Side

A student writing a paper on fractal geometry needs screenshots at iterations 1 through 4 to show how the curve fills space progressively.

INPUT
Run 4 times: Iter 1 = 9 segments Iter 2 = 81 segments Iter 3 = 729 segments Iter 4 = 6,561 segments
OUTPUT
4 PNG files showing progressive space-filling. Great for a figure series in a LaTeX document.

Who Uses This

🎓 Math Students

Generate visual examples of space-filling curves for homework, papers, and presentations on fractal geometry.

🎨 Generative Artists

Create intricate fractal patterns as base layers for digital art, posters, and album covers.

👩‍🏫 Educators

Build live demos showing how a 1D path can fill a 2D plane — a concept that is hard to explain without a visual.

👨‍💻 Developers

Test Canvas API rendering performance or grab a quick fractal texture for a creative coding project.

Common Mistakes

Starting at iteration 5 right away

59,049 line segments take a moment to render. Start at 2 or 3 first to check your color and width choices, then bump it up once you are happy with the look.

Picking a line color too close to the background

Dark gray on black or light yellow on white — the curve is there, you just can't see it. Make sure there is enough contrast between the two color pickers before hitting Draw.

Using a thick line width at high iterations

A 10px stroke at iteration 4 or 5 turns the fractal into a solid blob. The segments are so close together that thick lines overlap completely. Drop the width to 1 or 2 for anything above iteration 3.

Technical Details

Frequently Asked Questions

What is a Peano curve?

Giuseppe Peano described it in 1890 as a continuous curve that passes through every point inside a unit square. It was the first example of a space-filling curve — a single line that covers an entire 2D area when you let the iterations run to infinity.

How is the Peano curve different from the Hilbert curve?

Both fill a square, but they use different subdivision rules. The Hilbert curve splits each square into 4 parts (2x2), while the Peano curve splits into 9 parts (3x3). That means Peano curves grow faster — 9 segments per iteration instead of 4 — and have a denser look at the same iteration level.

Can I use the downloaded fractal image commercially?

Yes. The image is generated by math running in your browser. There is no license attached. Use it in prints, websites, videos, merchandise — whatever you need.

Why does my curve look like a solid block at high iterations?

That is the line width. At iteration 4 or 5, the curve segments sit extremely close together. A stroke width of 5 or more makes them overlap into a filled rectangle. Set the line width to 1 and the individual path becomes visible again.

Does this tool upload my data or images anywhere?

No. The entire thing runs locally in your browser using the Canvas API. Nothing gets sent to a server — not the settings, not the image. Close the tab and it is gone unless you downloaded the PNG first.

Share: