Pythagorean Theorem Calculator

Find the missing side of a right triangle from the other two — solves for a, b, or c.

How this works

The Pythagorean theorem says that in any right triangle, the square of the hypotenuse (c — the side opposite the right angle) equals the sum of the squares of the other two sides (a and b, the legs). It only works for triangles that contain a right angle (90°), but those show up everywhere — building corners, screen diagonals, ladder leaning against a wall, the diagonal walk across a rectangular field. Given any two sides you can solve for the third: c = √(a² + b²) when finding the hypotenuse, or a = √(c² − b²) (and likewise for b) when one of the legs is missing. The calculator picks the right form based on which side you mark as unknown, and also reports the triangle's area (½ × a × b) and perimeter (a + b + c) for free.

The formula

a² + b² = c² c = √(a² + b²) a = √(c² − b²) (with c > b) b = √(c² − a²) (with c > a)

a, b — the two legs (the sides that meet at the right angle). c — the hypotenuse, opposite the right angle. Always the longest side. Units stay consistent throughout: enter all sides in metres, you get metres back; enter inches, you get inches back. The calculator carries no units of its own.

Example calculation

  • Right triangle with legs a = 3 and b = 4. Find c.
  • a² + b² = 9 + 16 = 25.
  • c = √25 = 5. Classic 3–4–5 triangle.
  • Bonus: area = ½ × 3 × 4 = 6, perimeter = 3 + 4 + 5 = 12.

Frequently asked questions

Does this work for any triangle, or only right triangles?

Right triangles only — the theorem requires a 90° angle between sides a and b. For triangles without a right angle, you need the law of cosines (c² = a² + b² − 2ab·cos C), which reduces to Pythagoras when C = 90° (because cos 90° = 0). For solving general triangles by sides and angles, use a triangle calculator instead.

How do I know which side is the hypotenuse?

Two ways. First, geometrically: the hypotenuse is always opposite the right angle, never one of the two sides that forms it. Second, by length: in a right triangle the hypotenuse is always the longest side — strictly longer than each leg. So if you have three measurements and aren't sure which is the hypotenuse, take the largest. If two of your three numbers are tied for largest, the triangle is degenerate (flat) and you don't have a real triangle.

I keep getting the wrong answer when finding a leg. What gives?

Two common mistakes. First, sign: when finding a leg you subtract, not add — a = √(c² − b²), not √(c² + b²). Second, you must subtract the smaller square from the bigger one: c² − b² (because c is the hypotenuse, hence bigger than b). If you find yourself trying to take the square root of a negative number, you've probably swapped the hypotenuse with a leg. Double-check that the side you typed as c really is the longest one.

What's a "Pythagorean triple"?

A set of three positive whole numbers that satisfy a² + b² = c² exactly — no decimals or square roots. The smallest is (3, 4, 5); other common ones are (5, 12, 13), (8, 15, 17), and (7, 24, 25). Multiples of any triple are also triples — (6, 8, 10) is just 2 × (3, 4, 5). Builders use the 3–4–5 triple to lay out perfect right angles on site without needing a square: measure 3 along one edge, 4 along the other, and adjust until the diagonal hits exactly 5.

Related calculators