# Pythagoras tree generator

## World's simplest math tool

Free online Pythagoras tree fractal generator. Just press a button and you'll get a Pythagoras fractal. There are no ads, popups or nonsense, just an awesome Pythagorean tree generator. Press a button – get a tree. Created by mathematicians for mathematicians.

announcement
check out our new project!

We just created something new for all science fans – SCIURLS – a neat science news aggragator. Check it out!

A link to this tool, including input, options and all chained tools.

Can't convert.

Pythagoras tree generator tool
What is a pythagoras tree generator?

This tool draws the Pythagoras tree fractal. The Pythagoras tree is created as follows - take a rectangle (or a square), then adjacent to its top side draw two more rectangles at an angle so that the sides of all three rectangles form a right-angled triangle. If this triangle is isosceles, then the tree will grow symmetrically in both directions. If the triangle's base angles are different, then the Pythagorean tree will be tilted to the side of the smallest angle. In this tool, you can set the tilt angle and see how the Pythagorean tree evolves with each step of iteration. You can colorize the branches, add a contour line around each branch, and set the background color. You can also set the distance that the tree will be drawn from the frame. Additionally, you can generate coniferous tree type, semi-coniferous tree type, and alternating tree type. Once you have generated the tree that you like, you can resize it to your desired dimensions by entering width and height in pixels. Mathabulous!

Pythagoras tree generator examples
Click to use

Symmetrical Pythagorean Tree

This example generates a symmetric Pythagoras tree using twelve generations. It uses a square as the base figure. The outlines of recursively drawn squares are not visible here because it's set to zero. The fractal uses only two colors – black for the background and blue for the tree. Notice that as the branches twist, overlap and intersect, this fractal starts to look very similar to Levy C curve.

**Required options**

Angle of rotation at each
level stays the same.

At each level the rotation angle
increases or decreases so that
it reaches 45 degrees in the last iteration.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Regular Tree from Rectangles

In this example, we set the width of the initial rectangle to 100 pixels and height to 400 pixels. This base figure has a ratio of 4:1 and as a result, we grow a Pythagorean tree that's thin and tall. The rotation angle is 40 degrees, which makes the tree tilt to the right.

**Required options**

Angle of rotation at each
level stays the same.

At each level the rotation angle
increases or decreases so that
it reaches 45 degrees in the last iteration.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Coniferous Pythagorean Tree

In this example, we draw a coniferous Pythagoras tree. In this type of tree, the angle of rotation alternates at every level. On the first level, the left square rotates 60 degrees, and on the second level, the right square rotates 60 degrees, and so on. We set the rectangular shape of the image (800x1000px) and generate 15 iterations, without using a border around squares.

**Required options**

Left and right rectangles change
rotation angle at each level.

At each level the rotation angle
increases or decreases so that
it reaches 45 degrees in the last iteration.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Semi-Coniferous Pythagorean Tree

This example draws a semi-coniferous type of tree. This type alternates the rotation angle every two levels. On the first and second levels, the left square rotates by 50 degrees, and on the third and fourth by 90-50 = 40 degrees. The angles change up to the 11th iteration level this way.

**Required options**

Left and right rectangles change
rotation angle every two levels.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Realistic Pythagorean Tree

In this example, we generate a tree that looks very realistic, like you see in nature. This is achieved by selecting semi-coniferous tree type option (where alpha and beta angles swap every two levels), setting alpha angle to 34 degrees (beta is automatically set to 56 degrees), and using a non-square base rectangle. The height of each rectangle is 3 times greater than its width. This aspect ratio makes this Pythagoras tree look very realistic and all branches bend very smoothly. We also chose to use two colors here and used 15 iterative levels.

**Required options**

Left and right rectangles change
rotation angle every two levels.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Alternating Pythagorean Tree

This example draws an alternating type of tree. In this case, every pair of squares exchange base corner angles. Here we set the rotation angle to 58 degrees, which then turns to 32 degrees for the next pair of squares, then to 58 again, then 32, and so on. Also, in this example, we used an interesting combination of colors for the tree – we use the same color for the background and squares, and another for the contour. As a result we get a transparent-looking tree.

**Required options**

Left and right rectangles change
rotation angle every time.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Extraordinary Pythagorean Tree

Believe or not, this is also a Pythagorean tree. You've got to agree that it has a very unusual appearance. The reason it's so weird is that the width of each rectangle is 5 times greater than its height. It's drawn using alternating-angles method with the initial rotation angle of 50 degrees. It uses white fill color for rectangles, crimson for background and dark red color for the contour.

**Required options**

Left and right rectangles change
rotation angle every time.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Randomize Rotation Angles on Every Tree Level

In this example, we introduce some randomness in our Pythagoras trees. This example generates a Pythagoras tree that uses a random angle for every tree level. Note that one angle is randomly selected for every recursion level and it doesn't change on that level. For example, on the fifth level all triangles will have the same angle but fourth and sixth levels will have different angles. Every time you click on the example, you'll get something new because of randomization. Also you can just press the Draw a Pythagoras Tree button to get a new, random Pythagoras tree.

**Required options**

Random rotation angle is selected
for each level.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Randomize all Rotation Angles

This example uses a different tree randomization method. Here the rotation angles are randomly selected for each pair of squares. The branches each time tilt in different directions, creating a chaotic tree shape.

**Required options**

Random rotation angle is selected
for all rectangles.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Symmetrize Pythagoras Tree

This example uses the additional symmetrize function. This function gradually increases (or decreases) the angle to 45°. In our example, the tree starts at 10° and we generate 10 iterations of the tree. To achieve symmetry this angle has to be increased to 45°. To do it, at every iteration the angle increases by 3.5°. We can quickly calculate that by generating 10 levels we get 3.5° * 10 = 35° plus initial 10° makes it 45°.

**Required options**

Left and right rectangles change
rotation angle at each level.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Tilted Pythagoras Tree

In this example the angle of rotation of the left square is 30 degrees and right is 60 degrees. As a result left and right squares have different sizes and the whole tree is tilted to the left side. We also stretched the image horizontally by setting its size to 700x600px and set a black outline for squares with thickness of 2px.

**Required options**

Angle of rotation at each
level stays the same.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Random Rectangles

This example turns on the randomize rectangle sizes function. It does the obvious thing – the size of each rectangle gets randomized. Note that only height can be randomized because width is automatically computed so that every pair of rectangles formed a right triangle. In our case, the height is a random number from 1 to 200 (because we set base rectangle's height to 200). This is example is similar to the first example where we're drawing a regular Pythagorean tree with a base angle of 45 degrees but symmetry is lost here because of height randomization.

**Required options**

Angle of rotation at each
level stays the same.

Size of each rectangle is chosen
arbitrarily.

How many times to recursively
draw tree branches?

Tree width.

Tree height.

Base rectangle width.

Base rectangle height.

Angle of rotation of the left
rectangle.

Tree branches outline thickness.

Space between the frame and
the Pythagoras tree.

Pythagoras tree background
color.

Fill color for rectangles.

Color of the contour of the
rectangles.

Pro tips
Master online math 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://onlinemathtools.com/generate-pythagoras-tree?&width=600&height=600&base-width=100&base-height=100&iterations=12&background-color=black&line-segment-color=&fill-color=%231395ff&line-width=&padding=10&angle=45&direction=up®ular-tree=true&symmetrize-tree=false&randomize-rectangle-sizes=false

All math tools

Quickly visualize rules of an Lindenmayer rewrite system.

Quickly generate a list of primes.

Quickly generate a list of Fibonacci numbers.

Quickly generate a list of extended, negative Fibonacci numbers.

Quickly generate a list of Fibonacci primes.

Quickly generate a list of Fibonacci words.

Quickly generate a list of Tribonacci words.

Quickly generate a list of Lucas numbers.

Quickly generate a list of extended, negative Lucas numbers.

Quickly generate a list of Lucas numbers that are also prime numbers.

Quickly create a list of excessive numbers.

Quickly create a list of deficient numbers.

Quickly generate a list of perfect numbers.

Quickly create a list of slightly defective numbers.

Quickly generate random numbers.

Quickly generate a list of look-and-say sequence numbers.

Quickly create a list of Prouhet-Thue-Morse sequence values.

Quickly create a list of dragon curve sequence values.

Quickly create a list of Oldenburger-Kolakoski sequence values.

Quickly create a list of Gijswijt sequence values.

Quickly create a list of Golay-Rudin-Shapiro sequence values.

Quickly create a list of Baum-Sweet sequence values.

Quickly create a list of Moser-de Bruijn sequence values.

Quickly generate a list of even numbers.

Quickly generate a list of odd numbers.

Quickly find all factors of the given integer.

Quickly decompose integers into their prime factors.

Quickly find out if the given integer is a prime number.

Quickly check if the given number is a Fibonacci number

Quickly generate π constant's digits to arbitrary precision.

Quickly calculate Euler constant's digits to arbitrary precision.

Quickly calculate φ constant's digits to arbitrary precision.

Quickly calculate factorials.

Quickly create a triangluar array of binomial coefficients.

Quickly create a matrix with random elements.

Quickly create a unit matrix with ones along the diagonal.

Quickly find the transpose of a matrix.

Quickly find the inverse of a matrix.

Quickly calculate the determinant of a matrix.

Quickly find the sum of two or more matrices.

Find the difference of two or more matrices.

Quickly find the product of matrices.

Quickly draw a Hilbert space-filling curve.

Quickly draw a Heighway triangle fractal.

Quickly draw a Harter-Heighway space-filling dragon fractal.

Quickly draw a Davis-Knuth dragon fractal.

Quickly draw a triple dragon fractal.

Quickly draw a quaddragon fractal.

Quickly draw a hexdragon curve.

Quickly draw a Peano space-filling fractal.

Quickly draw a Moore space-filling curve.

Quickly draw a Peano-Gosper space-filling curve.

Quickly draw a Sierpinski arrowhead fractal curve.

Quickly draw a Sierpinski sieve fractal.

Quickly draw a Sierpinski closed plane fractal curve.

Quickly draw a Sierpinski carpet fractal.

Quickly draw a Sierpinski maze fractal.

Quickly draw a Sierpinski square fractal.

Quickly draw a Sierpinski pentaflake fractal.

Quickly draw a Sierpinski hexaflake fractal.

Quickly draw a Sierpinski n-gon fractal.

Quickly draw a Koch island fractal curve.

Quickly draw a Koch antisnowflake fractal.

Quickly draw a Koch triangle fractal.

Quickly draw a Koch n-gon fractal.

Quickly draw a quadratic Koch flake fractal.

Quickly draw a Cesaro fractal.

Quickly draw a Cesaro n-gon fractal.

Quickly draw a triflake fractal.

Quickly draw a quadric cross fractal.

Quickly draw a self-similar Levy C fractal curve.

Quickly draw a Vicsek snowflake fractal.

Quickly draw a T-square fractal.

Quickly draw a Cantor set fractal.

Quickly draw an asymmetric Cantor set fractal.

Quickly draw a generalized Cantor set fractal.

Quickly draw an ε-Cantor set fractal.

Quickly draw a Cantor dust fractal.

Quickly draw a Pythagoras tree fractal.

Quickly draw a Fibonacci word fractal.

Quickly draw an H-tree fractal.

Quickly draw a V-tree fractal.

Quickly generate a Morton Z-order fractal curve.

Coming soon
These math tools are on the way

Find n-th e Digit

Calculate the n-th digit of Euler's number.

Find n-th Golden Ratio Digit

Calculate the n-th digit of Golden Ratio.

Find n-th Pi Digit

Calculate the n-th digit of pi constant.

Decode a Look-and-say Sequence

Perform the inverse operation on a look-and-say sequence.

Generate Bell Number Sequence

Create a list of Bell numbers.

Generate Carmichael Number Sequence

Create a list of Charmichel numbers.

Generate Catalan Number Sequence

Create a list of Catalan numbers.

Generate Composite Number Sequence

Create a list of composite numbers.

Generate Secant Number Sequence

Create a list of secant numbers.

Generate Golomb Number Sequence

Create a list of Golomb-Silverman numbers.

Generate Euler's Totient Number Sequence

Create a list of Euler's phi numbers.

Generate Juggler Number Sequence

Create a list of juggler numbers.

Generate Lucky Number Sequence

Create a list of lucky numbers.

Generate Motzkin Number Sequence

Create a list of motzkin numbers.

Generate Padovan Number Sequence

Create a list of Padovan numbers.

Generate Pseudoperfect Number Sequence

Create a list of semiperfect numbers.

Generate Ulam Number Sequence

Create a list of Ulam numbers.

Generate Weird Number Sequence

Create a list of weird numbers.

Generate Superperfect Number Sequence

Create a list of superperfect numbers.

Partition a Number

Find all partitions of the given integer.

Generate Partition Number Sequence

Create a list of Partition function numbers.

Generate Arithmetic Progression

Create an arithmetic sequence of numbers.

Generate Geometric Progression

Create a geometric sequence of numbers.

Generate Natural Number Sequence

Create a list of natural numbers.

Generate Powers of Two

Create a list of numbers of powers of two.

Generate Powers of Ten

Create a list of numbers of powers of ten.

Multiply a Matrix by a Scalar

Multiply all matrix elements by a number.

Check if a Matrix is Singular

Determine if a matrix is degenerate.

Find the Co-factor Matrix

Given a matrix, find its cofactor matrix.

Find the Adjugate Matrix

Given a matrix, find its adjunct.

LU Factor a Matrix

Decompose a matrix into LU factors.

Find Matrix Eigenvalues

Find eigenvalues of a matrix.

Prettify a Matrix

Beautify a matrix by neatly aligning all its columns.

Reformat a Matrix

Convert matrix in one format to another format.

Draw a Fibonacci Spiral

Generate a Fibonacci spiral curve.

Draw Fibonacci Rectangles

Generate a drawing of Fibonacci rectangles.

Draw a Fibonacci Seed Head

Generate a Fibonacci flower head.

Draw a Padovan Fractal

Generate a Padovan equiliteral triangles fractal.

Draw a Apollonian Gasket

Generate an Apollonian gasket fractal.

Draw a Mandelbrot Fractal

Generate a Mandelbrot fractal.

Draw a Julia Fractal

Generate a Julia fractal.

Draw a Rauzy Fractal

Generate a Rauzy fractal.

Draw Blancmange Fractal Curve

Generate a Blancmange fractal.

Draw Weierstrass Function

Generate a Weierstrass fractal.

Draw Minkowski Question-mark Curve

Generate a Minkowski Question-mark fractal.

Draw Thomae's Function

Generate a Thomae's function (also known as popcorn or raindrop function).

Draw Dirichlet's Function

Generate a Dirichlet's function.

Convert Words to Numbers

Convert numbers as English text to actual digits.

Convert Numbers to Words

Convert numbers to written English text.

Convert Decimal Notation to Scientific Notation

Convert numbers written in decimal form to scientific form.

Convert Scientific Notation to Decimal Notation

Convert numbers written in scientific form to decimal form.

Round Numbers Up

Apply ceil operation to numbers.

Round Numbers Down

Apply floor operation to numbers.

Subscribe!
Never miss an update

Cool!

Notifications
We'll let you know when we add this tool

Cool!