onlinefractaltools logo

Pythagoras fractal

World's simplest fractal tool

This utility lets you draw custom and colorful Pythagoras fractals. We offer you more than twenty options to create a truly personalized fractal. The options are divided into three categories. The first category is for adjusting the image size and canvas dimensions, iterations, tree angle, and the proportions of the base rectangle from which the whole tree evolves. The second category is for adjusting colors and gradient. You can paint the fractal with a five-color palette. The first two colors define the background gradient, the next two are responsible for the tree gradient, and the last one sets the line drawing color. The third category lets you quickly switch between predefined Pythagoras tree species. The species include coniferous, semi-coniferous, cypress, and randomized trees. Fun fact – there are infinitely many logarithmic spirals hidden in a Pythagoras tree and they can be found by starting with any square and always following the closest square that goes to the left or right. Fractabulous!
a new math project! announcement
Love math as much as we do? Then you'll also love our new project – MATHURLS – a super neat math news aggregator. Check it out!
Iterations, Angle and Image Size
How many levels of branches to generate?
Left bending angle of the tree.
Image width.
Image height.
Padding.
Base width.
Base height.
Rectangle edge thickness.
Direction of tree growth.
Gradient and Color Palette
Canvas gradient starting color.
Canvas gradient ending color.
Trunk color (branch gradient starting color.)
Twigs color (branch gradient ending color.)
Palette for line around.
Pythagoras Tree Species
Bending angle same for all levels.
Alternate left and right angles at each level.
Alternate left and right angles every two levels.
Alternate left and right angles for each triangle.
Randomize angle for each level.
Randomize angle for each triangle.
Gradually change angle with each level to reach 45° at the twigs.
Randomize base size every time.
Pythagoras fractal tool What is a pythagoras fractal?
This online browser-based tool illustrates Pythagoras fractal trees. The Pythagoras tree is one of the most popular fractals in the fractal tree family that includes v-fractal and fractal canopy. The classic version of this fractal begins with a square but we've also added a modified version that begins with a rectangle. To construct the next iteration, take the square and build a right triangle on top of it so that the top edge of the square is the hypotenuse. Then, construct squares (or rectangles) on both sides of the triangle. This is the second level of the fractal. This construction is repeated recursively on each of the two new squares, and then recursively again on the new squares, until infinity. The limit of this construction is called the Pythagoras fractal (or the Pythagorean tree). If the sides of the interlevel triangle are equal, then the Pythagorean fractal will be symmetric. If the left corner is smaller than the right, the tree will tilt to the left side but if the right angle is less than the left, the tree will tilt to the right side. When the symmetric tree is drawn with a unit square as the base figure, the entire fractal (at infinite iteration) will fit exactly inside a 6x4 rectangle. Mind blowing and ingenious at the same time, or as we love to say – fractabulous!
Pythagoras fractal examples Click to use
Regular Pythagoras Fractal
In this example, we set the left bending angle equal to 45 degrees, and the right angle is calculated automatically as follows: 90 - 45 = 45 degrees. With these angles, the interlevel triangles are isosceles, and as a result, the whole tree has mirror symmetry with respect to the vertical axis going through the middle of the trunk. We generate 10 levels of branches, using all five colors in the palette. We set a mountain-meadow-green to deep-sea-green color gradient for the background, a white to pink-flamingo color gradient for the tree, which is applied from the tree root to twigs, and a pompadour color line for the square border.
In this example, we set the left bending angle equal to 45 degrees, and the right angle is calculated automatically as follows: 90 - 45 = 45 degrees. With these angles, the interlevel triangles are isosceles, and as a result, the whole tree has mirror symmetry with respect to the vertical axis going through the middle of the trunk. We generate 10 levels of branches, using all five colors in the palette. We set a mountain-meadow-green to deep-sea-green color gradient for the background, a white to pink-flamingo color gradient for the tree, which is applied from the tree root to twigs, and a pompadour color line for the square border.
Required options
These options will be used automatically if you select this example.
How many levels of branches to generate?
Left bending angle of the tree.
Image width.
Image height.
Padding.
Base width.
Base height.
Rectangle edge thickness.
Direction of tree growth.
Canvas gradient starting color.
Canvas gradient ending color.
Trunk color (branch gradient starting color.)
Twigs color (branch gradient ending color.)
Palette for line around.
Bending angle same for all levels.
Gradually change angle with each level to reach 45° at the twigs.
Randomize base size every time.
Coniferous Pythagoras Fractal
In this example, the left and right angles alternate at each recursive level. As a result, the Pythagoras fractal has a shape of a coniferous tree. We set the first left bending angle to 35 degrees that makes our tree to be tilted to the left side. We also set the proportions of the base rectangle to 1:2 to make the tree thinner and higher. To make the tree fit nicely in the canvas, we slightly lengthen the height of the canvas to 900 pixels, with a width of 800 pixels, and draw 12 recursive levels of rectangles.
In this example, the left and right angles alternate at each recursive level. As a result, the Pythagoras fractal has a shape of a coniferous tree. We set the first left bending angle to 35 degrees that makes our tree to be tilted to the left side. We also set the proportions of the base rectangle to 1:2 to make the tree thinner and higher. To make the tree fit nicely in the canvas, we slightly lengthen the height of the canvas to 900 pixels, with a width of 800 pixels, and draw 12 recursive levels of rectangles.
Required options
These options will be used automatically if you select this example.
How many levels of branches to generate?
Left bending angle of the tree.
Image width.
Image height.
Padding.
Base width.
Base height.
Rectangle edge thickness.
Direction of tree growth.
Canvas gradient starting color.
Canvas gradient ending color.
Trunk color (branch gradient starting color.)
Twigs color (branch gradient ending color.)
Palette for line around.
Alternate left and right angles at each level.
Gradually change angle with each level to reach 45° at the twigs.
Randomize base size every time.
Semi-coniferous Pythagoras Fractal
In this example, we generate a semi-coniferous Pythagoras tree. That means that the left and right angles alternate every two levels. That is, on the first and second level, the left bend angle is 56°, on the third and fourth 90° - 56° = 34°, on the fifth and sixth 56° again, and so on. We set the width of the base rectangle to 20% less than its height and perform 13 iterative steps. We use an individual branch gradient from gorse-yellow to flamenco-orange color for the tree fill and curious-blue to Stratos-blue color gradient for the background.
In this example, we generate a semi-coniferous Pythagoras tree. That means that the left and right angles alternate every two levels. That is, on the first and second level, the left bend angle is 56°, on the third and fourth 90° - 56° = 34°, on the fifth and sixth 56° again, and so on. We set the width of the base rectangle to 20% less than its height and perform 13 iterative steps. We use an individual branch gradient from gorse-yellow to flamenco-orange color for the tree fill and curious-blue to Stratos-blue color gradient for the background.
Required options
These options will be used automatically if you select this example.
How many levels of branches to generate?
Left bending angle of the tree.
Image width.
Image height.
Padding.
Base width.
Base height.
Rectangle edge thickness.
Direction of tree growth.
Canvas gradient starting color.
Canvas gradient ending color.
Trunk color (branch gradient starting color.)
Twigs color (branch gradient ending color.)
Palette for line around.
Alternate left and right angles every two levels.
Gradually change angle with each level to reach 45° at the twigs.
Randomize base size every time.
Cypress Pythagoras Fractal
In this example, the Pythagoras fractal grows to an extraordinary shape because the height of the base rectangle is set to be 3 times smaller than its width. With these base figure dimensions and the cypress tree type, it looks more like a bush than a tree. We iterate this bush for 11 stages and set the bending angle is 38 degrees. We also use a rectangular canvas of 800 by 600 pixels and padding of 10 pixels around the trunk and bush tips.
In this example, the Pythagoras fractal grows to an extraordinary shape because the height of the base rectangle is set to be 3 times smaller than its width. With these base figure dimensions and the cypress tree type, it looks more like a bush than a tree. We iterate this bush for 11 stages and set the bending angle is 38 degrees. We also use a rectangular canvas of 800 by 600 pixels and padding of 10 pixels around the trunk and bush tips.
Required options
These options will be used automatically if you select this example.
How many levels of branches to generate?
Left bending angle of the tree.
Image width.
Image height.
Padding.
Base width.
Base height.
Rectangle edge thickness.
Direction of tree growth.
Canvas gradient starting color.
Canvas gradient ending color.
Trunk color (branch gradient starting color.)
Twigs color (branch gradient ending color.)
Palette for line around.
Alternate left and right angles for each triangle.
Gradually change angle with each level to reach 45° at the twigs.
Randomize base size every time.
Partially Randomized Tree
In this example, the tool randomly selects the rotation angle for each iterative level and keeps it constant for all triangles on that level. However, as we have also activated the tree symmetrization option, the closer we get to the last iteration, the closer the angle gets to 45 degrees. At the last level, all the angles are 45 degrees. We set the rectangle ratio to 2:5 and generate 12 recursive stages. For the color palette, we use a deep-blue to congress-blue color gradient for the background and aqua to magenta color gradient for the branches.
In this example, the tool randomly selects the rotation angle for each iterative level and keeps it constant for all triangles on that level. However, as we have also activated the tree symmetrization option, the closer we get to the last iteration, the closer the angle gets to 45 degrees. At the last level, all the angles are 45 degrees. We set the rectangle ratio to 2:5 and generate 12 recursive stages. For the color palette, we use a deep-blue to congress-blue color gradient for the background and aqua to magenta color gradient for the branches.
Required options
These options will be used automatically if you select this example.
How many levels of branches to generate?
Left bending angle of the tree.
Image width.
Image height.
Padding.
Base width.
Base height.
Rectangle edge thickness.
Direction of tree growth.
Canvas gradient starting color.
Canvas gradient ending color.
Trunk color (branch gradient starting color.)
Twigs color (branch gradient ending color.)
Palette for line around.
Randomize angle for each level.
Gradually change angle with each level to reach 45° at the twigs.
Randomize base size every time.
Absolutely Randomized Tree
This example randomizes both key tree properties. The bending angle for each branch is chosen arbitrarily and the proportions of each rectangle are also selected randomly. Thus, we get an absolutely randomized Pythagorean tree with branches and twigs going in all possible directions. We color this tree with a paua to pompadour color gradient in the tree direction and calculate 15 iterations.
This example randomizes both key tree properties. The bending angle for each branch is chosen arbitrarily and the proportions of each rectangle are also selected randomly. Thus, we get an absolutely randomized Pythagorean tree with branches and twigs going in all possible directions. We color this tree with a paua to pompadour color gradient in the tree direction and calculate 15 iterations.
Required options
These options will be used automatically if you select this example.
How many levels of branches to generate?
Left bending angle of the tree.
Image width.
Image height.
Padding.
Base width.
Base height.
Rectangle edge thickness.
Direction of tree growth.
Canvas gradient starting color.
Canvas gradient ending color.
Trunk color (branch gradient starting color.)
Twigs color (branch gradient ending color.)
Palette for line around.
Randomize angle for each triangle.
Gradually change angle with each level to reach 45° at the twigs.
Randomize base size every time.
Pro tips Master online fractal tools
You can pass options to this tool using their codes as query arguments and it will automatically compute output. To get the code of an option, just hover over its icon. Here's how to type it in your browser's address bar. Click to try!
https://onlinefractaltools.com/draw-pythagoras-fractal?&iterations=10&angle=45&width=900&height=900&base-width=100&base-height=100&line-width=1&padding=20&direction=up&gradient-from-trunk-to-twigs=true&background-from-color=%2317ada1&background-to-color=%23084a49&fill-from-color=white&fill-to-color=%23ff5cf1&line-segment-color=%23630059®ular-tree=true&symmetrize-tree=false&randomize-rectangle-sizes=false
All fractal tools
Didn't find the tool you were looking for? Let us know what tool we are missing and we'll build it!
Quickly draw a custom McWorter dendrite fractal.
Quickly draw a custom canopy tree fractal.
Quickly draw a custom Gosper fractal.
Quickly draw a custom Z-order fractal.
Quickly draw a custom Hilbert fractal.
Quickly draw a custom binary v-fractal.
Quickly draw a custom Peano fractal.
Quickly draw a custom Heighway dragon fractal.
Quickly draw a custom twin dragon Heighway fractal.
Quickly draw a custom Heighway nonadragon fractal.
Quickly draw a custom Koch fractal.
Quickly draw a custom triflake fractal.
Quickly draw a custom Sierpinski triangle fractal.
Quickly draw a custom Sierpinski pentagon fractal.
Quickly draw a custom Sierpinski hexagon fractal.
Quickly draw a custom Sierpinski polygon fractal.
Quickly draw a custom Moore fractal.
Quickly draw a custom Cantor comb fractal.
Quickly draw a custom Cantor dust fractal.
Quickly draw a custom Levy fractal curve.
Quickly draw a custom ice fractal.
Quickly draw a custom Pythagoras tree fractal.
Quickly draw a custom t-square fractal.
Quickly draw a custom Hausdorff tree fractal.
Coming soon These fractal tools are on the way
Generate a Hilbert Sequence
Walk the Hilbert fractal and enumerate its coordinates.
Generate a Peano Sequence
Walk the Peano fractal and enumerate its coordinates.
Generate a Moore Sequence
Walk the Moore fractal and enumerate its coordinates.
Generate a Cantor String
Encode the Cantor set as a string.
Mandelbrot Tree
Generate a Mandelbrot tree fractal.
Barnsey's Tree
Generate a Barnsley's tree fractal.
Barnsey's Fern
Generate a Barnsley's fern fractal.
Binary Fractal Tree
Generate a binary tree fractal.
Ternary Fractal Tree
Generate a ternary tree fractal.
Dragon Fractal Tree
Generate a dragon tree fractal.
De Rham Fractal
Generate a de Rham curve.
Takagi Fractal
Generate a Takagi-Landsberg fractal curve.
Peano Pentagon
Generate a Peano pentagon fractal curve.
Tridendrite Fractal
Generate a tridendrite fractal curve.
McWorter's Pentigree
Generate a Pentigree fractal curve.
McWorter's Lucky Seven
Generate a lucky seven fractal curve.
Eisenstein Fractions
Generate an Eisenstein fractions fractal curve.
Bagula Double V
Generate a Bagula double five fractal curve.
Julia Set
Generate a Julia fractal set.
Mandelbrot Set
Generate a Mandelbrot fractal set.
Toothpick Fractal
Generate a toothpick sequence fractal.
Ulam-Warburton Fractal
Generate an Ulam-Warburton fractal curve.