Tools

Home
Password GeneratorLorem IpsumCoin FlipperRandom StringToken GeneratorRandom Color

Draw Pythagoras Tree Fractal

Generate a Pythagoras tree fractal. A plane fractal constructed from squares. 100% client-side.

Your files never leave your browser
Ready·Canvas API

Generate a Pythagoras tree fractal — up to 12 recursive levels deep — by setting the branching angle, picking trunk and leaf colors, and clicking Draw. At 45° the tree splits evenly; shift the angle and one side stretches while the other shrinks, giving you anything from a balanced canopy to a wind-swept spiral. Export the result as a PNG when it looks right.

And everything runs in your browser. Nothing gets uploaded.

How It Works

Set Angle & Depth
→
Recursive Drawing
→
PNG Export

The algorithm starts with a single square at the base. On each iteration, it places a right triangle on the top edge of every existing square, then attaches two smaller squares to the triangle’s legs. The branching angle you pick controls the triangle’s shape — which changes the ratio between left and right branches. Color interpolates from trunk to leaf as depth increases, so you get a smooth gradient without any extra work.

Examples

Classic Symmetric Tree

The textbook version — perfect balance on both sides.

INPUT
Angle: 45° Iterations: 10 Trunk: #5B3A29 Leaf: #228B22 Background: #FFFFFF
OUTPUT
A balanced tree with 1,024 leaf squares. Brown base fades to green at the tips. Fills a roughly circular canopy.

Wind-Swept Asymmetric

Lowering the angle makes one branch dominate — looks like a tree growing on a cliff edge.

INPUT
Angle: 25° Iterations: 11 Trunk: #2C2C2C Leaf: #FF6B35
OUTPUT
Lopsided tree leaning left. Dark gray trunk fading to burnt orange. The long branch spirals outward while the short one stays compact.

Minimal Low-Iteration Poster Art

Fewer levels, bold colors — good for printing on a wall.

INPUT
Angle: 45° Iterations: 5 Trunk: #1A1A2E Leaf: #E94560 Background: #0F3460
OUTPUT
32 leaf squares. Bold geometric look — individual squares are clearly visible. Deep navy background with dark-to-red gradient. Clean enough for a poster or slide deck.

Who Uses This

🎓 Math Teachers

Show students how the Pythagorean theorem creates a visual pattern — way more engaging than a textbook diagram.

🎨 Generative Artists

Export custom-colored fractals as PNGs for prints, album covers, or backgrounds.

💻 CS Students

Visualize recursion depth in real time by stepping through iteration counts from 1 to 12.

📐 Designers

Grab geometric fractal patterns for presentations, posters, or brand assets without firing up Illustrator.

Common Mistakes

Maxing iterations right away

Jumping straight to 12 iterations on a slower machine can lag the browser for a few seconds. Start at 8 or 9 and work up — you’ll see where your hardware hits its limit.

Picking trunk and leaf colors that are too similar

The gradient blends between trunk and leaf color. If they’re close (say, dark green and slightly darker green), the whole tree looks flat. Use colors with obvious contrast — brown-to-green, black-to-orange, navy-to-pink.

Forgetting about the background color

A white tree on a white background is invisible. If your exported PNG looks blank, check that the background contrasts with your trunk color. Dark backgrounds with bright leaves tend to look best.

Technical Details

Frequently Asked Questions

What is a Pythagoras tree fractal?

It’s a fractal made entirely of squares. You start with one square, stick a right triangle on top, then attach two smaller squares to the triangle’s non-hypotenuse sides. Repeat that process and you get a branching tree shape that demonstrates the Pythagorean theorem at every single level.

Why does the angle change the tree shape so much?

The angle sets the proportions of the right triangle. At 45° both legs are equal, so both branches grow at the same rate — symmetric tree. Move to 30° and the left leg gets longer than the right, so one branch dominates. Small angle changes compound across iterations, which is why a 5° shift can drastically change the final shape.

Can I use the generated fractal commercially?

Yes. The image is rendered locally in your browser and belongs to you. No watermarks, no attribution required. Print it, put it on a shirt, use it in a presentation — it is yours.

Why does the tree look different at high iterations vs low?

At low iterations (3–5) you can see every individual square. The tree looks geometric and blocky. Crank it to 10+ and the squares get so small they blur together into what looks like organic foliage. Same math — totally different visual effect.

Is my data sent to a server?

No. The fractal is drawn using the Canvas API right in your browser tab. Nothing gets uploaded. Your color choices, angle settings, and generated images stay on your device. Close the tab and it is gone.

Share: