Home Tools Blog About

Draw Pythagoras Fractal

In short

Draw the Pythagoras tree (Bosman 1942) - recursive squares + Pythagorean theorem. Angle 30-60°, gradient mode. Free, offline, client-side, instant, secure.

  • Runs in your browser
  • Nothing uploaded
  • Free, no sign-up

Renders the Pythagoras tree (Albert E. Bosman, 1942): every node splits into two child squares with sides cos(θ) and sin(θ) times the parent's side. The Pythagorean identity cos²(θ) + sin²(θ) = 1 makes the child areas add up to the parent's area.

🛡
100% PrivateNo server uploads, ever
InstantRuns in your browser
💧
No WatermarksClean output, always
🆓
Free ForeverNo accounts, no limits

How to Use Draw Pythagoras Fractal

Draw Pythagoras Fractal · free online tool · All Tools Verse
Draw Pythagoras Fractal. Free online tool that runs in your browser.
  1. Set iterations (1-12). Total squares = 2ᴺ⁺¹ − 1: iter 10 = 2,047; iter 12 = 8,191. (An earlier version of this tool's code dropped the leaf generation and produced half that - fixed now.)
  2. Pick the branching angle (30°-60°). 45° is symmetric. Angles far from 45° make the tree visibly self-overlap.
  3. Pick render mode. Gradient (the default) shades each square by its recursion depth; solid uses the trunk color throughout; outline shows just the polygon edges.
  4. Pick trunk and leaf colors. A toast warns if the two colors are too close in luminance for the gradient to be readable.
  5. Pick canvas size and background. Transparent background is useful when exporting for overlay use.
  6. Click Draw Tree or press Ctrl/Cmd + Enter. Iter 11+ shows a non-blocking time estimate toast - no modal interrupts you.
  7. Copy or download the PNG; the filename includes the iteration count and angle.

Frequently Asked Questions

What is the Pythagoras tree?

The Pythagoras tree is a plane fractal first described by the Dutch mathematics teacher Albert E. Bosman in his 1942 book “Het wondere onderzoekingsveld der vlakke meetkunde” (The Wondrous Field of Investigation of Plane Geometry). He drew it by hand. The construction: start with a square (the trunk). On top of the square, erect a right triangle. The two non-hypotenuse sides of the triangle become the sides of two new squares – and the same procedure is applied to each new square recursively.

How is the Pythagorean theorem involved?

If the branching angle is θ, the two child squares have sides cos(θ) and sin(θ) times the parent side. So the sum of their areas is cos²(θ) + sin²(θ) = 1 times the parent area – exactly the parent’s area. The total covered area is therefore conserved at every level: the tree always has the same total area as a single unit square, no matter how deep you go.

How many squares does iteration N produce?

2 to the (N+1) minus 1. The tree is a binary recursion: 1 trunk at level 0, 2 children at level 1, 4 at level 2, …, 2 to the N at level N. The geometric series sums to 2 to the (N+1) minus 1. Iter 10 = 2,047. Iter 12 = 8,191. An older version of this tool’s code accidentally skipped the leaf generation (returned before pushing the last layer) so it produced 2 to the N minus 1 instead – half the correct count. That bug is fixed; the stats line shows the real number.

What is the fractal dimension?

By the Pythagorean identity, the IFS (similarity) dimension is exactly 2.0 for every branching angle, not just 45°. Solve the Moran equation cos(θ) to the d plus sin(θ) to the d equals 1: at d = 2 we get cos²+sin² = 1, which holds for any θ. However, at angles far from 45° the tree self-overlaps, so the box-counting dimension of the actually visible figure dips below 2. The classical “the Pythagoras tree fills 2D space” statement strictly applies in the IFS sense; in the rendered image, only 45° has a non-overlapping tree that genuinely covers a finite area exactly.

What does the gradient mode show?

Each square’s recursion depth – from 0 at the trunk to N at the leaves – is mapped to a color interpolated linearly between the trunk color and the leaf color. So the trunk takes the trunk color, the topmost leaves take the leaf color, and intermediate generations sit on a smooth gradient between them. It is the easiest way to see how many recursion levels are actually rendered.

Why do small angles look “wind-swept”?

At θ small, cos(θ) is close to 1 and sin(θ) is close to 0 – one child square is almost as big as the parent and the other is tiny. The tree grows mostly in one direction, and the small branches are barely visible. At θ close to 90° the same thing happens in mirror. At 45° both children are size √2/2 ≈ 0.707 of the parent and the tree is symmetric.

Why does the tree look like real foliage?

Real plants use very similar recursive branching – each node splits into two (or more) sub-branches at a roughly constant angle. The Pythagoras tree at 45° doesn’t look exactly like a maple, but the structural similarity is strong, which is why it appears in biology textbooks alongside L-system plant models. It is one of the canonical examples of “fractal in nature”.

Is anything sent to a server?

No. The tool loads three static files (HTML, CSS, JS) and then runs entirely in your browser – recursion, drawing, PNG export, clipboard copy. You can disconnect from the internet after the page loads. No analytics, no tracking, no cookies.

Is this tool free?

Yes – free, unlimited, no signup, no watermark. Use the PNGs in lectures, papers, blog posts, or art freely. Attribution to is appreciated but not required.

Keep going

Related Tools

All Fractals tools →

Draw Canopy Fractal

Draw a canopy-tree L-system fractal in your browser. 7 iterations, custom colors, gradient depth,…

Draw Cantor Dust Fractal

Draw true Cantor Dust (4-corner) or Sierpiński carpet (8-square) in your browser. Color modes,…

Draw Cantor Fractal

Draw the Cantor set with middle-third deletion. 0-10 iterations, custom colors, dimension and measure…

Draw Flowsnake Fractal

Draw the Gosper curve hexagonal space-filling fractal in your browser. Iterations 1-6, custom colors,…

Draw Frosty Fractal

Draw Frosty Fractal online, free and private. Runs in your browser, no upload, instant…

Draw Hausdorff Fractal

Draw the Hilbert curve or Moore curve (closed-loop variant) - true space-filling fractals (dim…

Draw Heighway Fractal

Draw the Heighway dragon (paper-folding fractal) with fire gradient and symmetry modes. L-system based.…

Draw Hexaflake Fractal

Draw the hexaflake (hexagon snowflake) - 7-hexagon recursive fractal with 6-fold symmetry. Custom colors,…

Draw Hilbert Fractal

Draw the Hilbert space-filling curve in your browser. 9 iterations, rotation, gradient, endpoints. Free,…

Draw Koch Fractal

Draw Koch curve, snowflake, or anti-snowflake at any angle. Iterations 0-7. Free, offline, client-side,…

Draw Levy Fractal

Draw the Lévy C-curve (Paul Lévy 1938) - space-filling fractal at 45°. Gradient and…

Draw Mcworter Dendrite Fractal

Draw Mcworter Dendrite Fractal online, free and private. Runs in your browser, no upload,…

Share

Embed this tool

Add this free tool to your website. Copy and paste the code: