Home › Math › Pythagorean Theorem Calculator

Pythagorean Theorem Calculator

Use this free Pythagorean theorem calculator to solve for any side of a right triangle. Enter any two sides — the two legs, or one leg and the hypotenuse — and the calculator finds the missing side, along with the area and perimeter of the triangle, and draws a labelled diagram that updates as you type. It also includes the classic 3-4-5, 5-12-13 and 8-15-17 triple presets, so you can check a known triangle in one click. It runs entirely in your browser, with no sign-up and nothing to install.

c = 5
Area = 6 · Perimeter = 12

Enter the two sides you know. When solving for a leg, the hypotenuse must be longer than the other leg, or no right triangle is possible.

Your right triangle

Side a runs along the bottom, side b up the left, and the hypotenuse c slopes across. The small square marks the right angle.

How it works

The Pythagorean theorem is one of the oldest and most useful facts in geometry. It says that in any right triangle — a triangle with one angle of exactly 90 degrees — the square of the hypotenuse equals the sum of the squares of the other two sides. Written as a formula, that is a² + b² = c², where a and b are the legs (the two sides that meet at the right angle) and c is the hypotenuse (the side opposite the right angle, which is always the longest side of the triangle). The theorem is named after the Greek mathematician Pythagoras, though builders in Egypt and Babylon were using the same rule to lay out square corners more than a thousand years earlier.

The calculator rearranges that one formula three ways, depending on which side is missing. To find the hypotenuse from the two legs, it squares both legs, adds them, and takes the square root: c = √(a² + b²). To find a missing leg when you know the hypotenuse and the other leg, it subtracts instead: a = √(c² − b²), or b = √(c² − a²). The subtraction form is where mistakes happen by hand, so it is worth remembering that the hypotenuse is always the number you square first and subtract from — if the known leg is longer than the hypotenuse, the numbers cannot form a right triangle at all, and the calculator says so plainly instead of trying to take the square root of a negative number.

Once all three sides are known, the area and perimeter follow immediately. The area of a right triangle is half the product of the two legs, (a × b) ÷ 2, because a right triangle is exactly half of the rectangle built on its two legs — cut that rectangle along the diagonal and you get two identical triangles. The perimeter is simply the sum of all three sides, a + b + c. For the 3-4-5 triangle the area is (3 × 4) ÷ 2 = 6 square units and the perimeter is 3 + 4 + 5 = 12 units. The diagram beside the calculator draws your triangle to scale, with each side labelled, so you can see at a glance whether the shape looks like the numbers you entered.

Some right triangles have all three sides as whole numbers, and those are called Pythagorean triples. The most famous is 3-4-5, and the others in the preset menu — 5-12-13, 8-15-17, 7-24-25 and 20-21-29 — are the ones that come up most often in textbooks and on building sites. Any multiple of a triple is also a triple, so 6-8-10 and 9-12-15 are triples too, because scaling every side by the same factor keeps the equation balanced. Builders have used the 3-4-5 rule for centuries to check that a corner is square: measure 3 feet along one wall and 4 feet along the other, and if the diagonal between the marks is exactly 5 feet, the corner is a true right angle. That trick works because the theorem runs in both directions — if a² + b² = c², the angle between a and b must be 90 degrees.

Real problems rarely hand you tidy whole numbers, so the calculator accepts decimals as well. Measure a ramp, a ladder against a wall, or the diagonal of a screen, and the same formula applies: a 10-foot ladder leaning with its base 6 feet from a wall reaches √(10² − 6²) = √(100 − 36) = √64 = 8 feet up the wall. Screen sizes are measured the same way — a 55-inch television is 55 inches across the diagonal, and the width and height follow from the same equation once you know the aspect ratio. Whenever you have two sides of a right triangle and need the third, this is the tool for the job; just remember it only applies to triangles with a right angle, and for any other triangle you need the law of cosines instead.

Worked example

Take the classic 3-4-5 triangle. Enter leg a = 3 and leg b = 4, and choose to solve for the hypotenuse c. The calculator squares each leg: 3² = 9 and 4² = 16. It adds the squares: 9 + 16 = 25. Then it takes the square root: √25 = 5. So the hypotenuse is exactly 5, with no decimals, which is what makes 3-4-5 a Pythagorean triple.

The area is half the product of the legs: (3 × 4) ÷ 2 = 12 ÷ 2 = 6 square units. The perimeter adds all three sides: 3 + 4 + 5 = 12 units. Type 3 and 4 into the calculator and it shows the same results — c = 5, area 6, perimeter 12 — with the triangle drawn to scale in the diagram.

Now try the subtraction form. Choose to solve for leg b, enter leg a = 5 and hypotenuse c = 13, and the calculator computes b = √(13² − 5²) = √(169 − 25) = √144 = 12. The 5-12-13 triangle checks out: the area is (5 × 12) ÷ 2 = 30 square units and the perimeter is 5 + 12 + 13 = 30 units. Picking the 5-12-13 preset fills in all three numbers at once, so you can verify any of the three forms in a single click.

FAQ

What is the Pythagorean theorem?

The Pythagorean theorem says that in a right triangle, the square of the hypotenuse equals the sum of the squares of the other two sides: a² + b² = c². The hypotenuse is the side opposite the right angle and is always the longest side of the triangle.

How do I find the hypotenuse of a right triangle?

Square both legs, add the squares together, and take the square root of the total. For legs of 3 and 4, that is √(3² + 4²) = √(9 + 16) = √25 = 5. This calculator does the same steps for any two sides you enter.

Can I use the Pythagorean theorem on a triangle without a right angle?

No. The theorem only holds for right triangles — triangles with one 90-degree angle. For other triangles you need the law of cosines, which is the general version of the same idea and works for any angle.

What are Pythagorean triples?

Pythagorean triples are sets of three whole numbers that satisfy a² + b² = c² exactly, with no decimals. The most famous is 3-4-5, and others include 5-12-13, 8-15-17 and 7-24-25. Builders use them to check square corners, because a 3-4-5 triangle guarantees a right angle.

How do I find a missing leg when I know the hypotenuse?

Rearrange the formula: a = √(c² − b²). Square the hypotenuse, subtract the square of the known leg, and take the square root. The hypotenuse must be longer than the known leg, or there is no such triangle — this calculator will tell you if the numbers cannot form a right triangle.