Pythagorean Theorem Calculator
Find the hypotenuse of a right triangle from its two legs using a² + b² = c². The cornerstone of geometry, trigonometry, and distance measurement.
Last updated: May 2026
Compare with similar
About this calculator
The Pythagorean theorem relates the three sides of a right triangle (a triangle with one 90° angle). It states that the square of the hypotenuse — the longest side, opposite the right angle — equals the sum of the squares of the other two sides: a² + b² = c². This calculator solves for the hypotenuse c by computing c = √(a² + b²), where a and b are the two legs. The theorem works only for right triangles, and the hypotenuse is always the longest side because it sits opposite the largest angle. Its applications are vast: it underlies the distance formula in coordinate geometry, navigation, construction (checking that corners are square using the 3-4-5 rule), and countless engineering and physics problems. You can also rearrange it to find a missing leg: a = √(c² − b²), provided c is the hypotenuse. Edge cases: certain whole-number side combinations called Pythagorean triples — such as (3, 4, 5), (5, 12, 13), and (8, 15, 17) — produce integer hypotenuses and are worth recognizing. If the result is not a whole number, it is an irrational square root, so the decimal answer is an approximation. The theorem fails for non-right triangles, where the law of cosines (a generalization that includes an angle term) must be used instead.
How to use
Example 1 — legs of 3 and 4. Enter Side A = 3, Side B = 4. The hypotenuse c = √(3² + 4²) = √(9 + 16) = √25 = 5. Verify: this is the classic 3-4-5 right triangle, the most famous Pythagorean triple, often used by builders to confirm a square corner. Example 2 — legs of 5 and 12. Enter Side A = 5, Side B = 12. The hypotenuse c = √(5² + 12²) = √(25 + 144) = √169 = 13. Verify: (5, 12, 13) is another Pythagorean triple, giving a clean whole-number hypotenuse, which confirms the arithmetic.
Frequently asked questions
What is the hypotenuse and how do I identify it?
The hypotenuse is the longest side of a right triangle, and it always sits directly opposite the 90° angle. The other two sides, which form the right angle between them, are called the legs. Because it is opposite the largest angle, the hypotenuse is guaranteed to be longer than either leg. This calculator solves for the hypotenuse from the two legs, so make sure the values you enter are the legs, not the hypotenuse. A quick sanity check: your computed hypotenuse should always be larger than both inputs. If it is not, you have likely entered the hypotenuse as one of the legs.
Can I use this to find a missing leg instead of the hypotenuse?
The theorem can find any missing side, but this particular calculator solves specifically for the hypotenuse from two legs. To find a leg when you know the hypotenuse and the other leg, rearrange the formula to a = √(c² − b²), where c is the hypotenuse. For example, if the hypotenuse is 13 and one leg is 5, the other leg is √(169 − 25) = √144 = 12. The key difference is that you subtract rather than add the squares when solving for a leg. Be sure to identify which side is the hypotenuse first, since it must be the largest value.
What are Pythagorean triples?
Pythagorean triples are sets of three positive integers that satisfy a² + b² = c², meaning a right triangle with those side lengths has a whole-number hypotenuse. The best-known is (3, 4, 5), followed by (5, 12, 13), (8, 15, 17), and (7, 24, 25). Any multiple of a triple is also a triple, so (6, 8, 10) works too. These are useful in construction and design because they let you create exact right angles without measuring angles directly — the 3-4-5 method is a builder's staple. Recognizing them also provides a quick check that your calculation is correct when the answer comes out as a clean integer.
Does the Pythagorean theorem work for all triangles?
No — it applies only to right triangles, those containing exactly one 90° angle. Using it on an acute or obtuse triangle will give a wrong answer. For non-right triangles, you must use the law of cosines, c² = a² + b² − 2ab·cos(C), which generalizes the Pythagorean theorem by adding a term involving the included angle; when that angle is 90°, the cosine term vanishes and it reduces to the familiar a² + b² = c². So the Pythagorean theorem is really a special case. Always confirm your triangle has a right angle before applying it, or your result will be invalid.
When should I NOT use this calculator?
Do not use it unless your triangle has a right angle, since the theorem is invalid for any other triangle — use the law of cosines instead. It also solves only for the hypotenuse from two legs, so it is the wrong tool if you need a missing leg (rearrange the formula) or an angle (use trigonometry). Make sure both legs are in the same unit, and remember that a non-triple result is an irrational number, so the decimal is rounded. For three-dimensional distances, you extend the idea to √(a² + b² + c²) rather than using this two-dimensional version. And for points on a coordinate plane, the closely related distance formula is more direct.