Pythagorean Theorem Calculator

Find a missing side of a right triangle with a² + b² = c², choosing whether to calculate the hypotenuse or a leg.

Calculations happen locally. We do not send your values to our server.

Example

Legs of 3 and 4 give a hypotenuse of 5, and legs of 5 and 12 give 13. To find a leg instead, a known leg of 8 with a hypotenuse of 17 gives 15, and a leg of 6 with a hypotenuse of 10 gives 8.

Calculation method

For the hypotenuse the tool adds the squares of both legs and takes the square root, so c = √(a² + b²). For a leg it subtracts the square of the known leg from the square of the hypotenuse before taking the square root. Select the side you need first; the field for that side is ignored, so you do not have to clear it.

Important notes

Use the same unit for both known sides and the answer comes out in that unit. All sides must be positive, and when calculating a leg the hypotenuse must be longer than the known leg, so a hypotenuse of 5 with a leg of 6 is rejected. The relationship holds only for right triangles.

Choose the missing side

Select whether you need the hypotenuse c or one of the legs a and b, then fill in the two known sides in the same unit. With legs of 3 and 4, the hypotenuse is 5; with legs of 5 and 12, it is 13. To find a leg, enter the other leg and the hypotenuse: a leg of 8 with a hypotenuse of 17 gives a missing leg of 15. The input for the side being calculated is ignored, so you do not need to clear it before calculating.

Checking corners and diagonals

Builders use the 3-4-5 relationship to set out a right angle: measure 3 m along one line and 4 m along the other, and the diagonal between those marks should be exactly 5 m. Any multiple works, such as 6-8-10. The same calculation gives the diagonal of a rectangle: a panel 2.5 by 6 units has a diagonal of 6.5. A 1 by 1 square has a diagonal of about 1.41421356, the square root of 2, which never ends as a decimal.

Rules the inputs must follow

The hypotenuse is always the longest side and is opposite the right angle, so when calculating a leg the hypotenuse must be larger than the known leg. A leg of 6 with a hypotenuse of 10 gives 8, but a hypotenuse of 5 with a leg of 6 is rejected. All sides must be positive. The relationship a² + b² = c² is true only for right triangles. For other triangles use the law of cosines, or use the Triangle Area Calculator when you know all three sides and need the area.

Worked examples
InputResult
a 3 · b 4c = 5
a 5 · b 12c = 13
b 8 · c 17a = 15
a 6 · c 10b = 8
a 2.5 · b 6c = 6.5
a 1 · b 1c = 1.41421356

Frequently asked questions

How do I check that a corner is square?

Use the 3-4-5 relationship: measure 3 along one line and 4 along the other, and the diagonal between the marks should be exactly 5. Any multiple works just as well, such as 6-8-10, and a larger triangle gives a more accurate result over a long wall.

Can I use it for a diagonal?

Yes. The diagonal of a rectangle is the hypotenuse of two right triangles, so a panel 2.5 by 6 units has a diagonal of 6.5. A 1 by 1 square has a diagonal of about 1.41421356, the square root of 2, which never ends as a decimal and is shown rounded.

What if my triangle has no right angle?

Then a² + b² = c² does not apply and the answer would be wrong. Use the law of cosines when you know two sides and the angle between them. If you know all three sides and need the area instead, use the Triangle Area Calculator.

Related tools