Skip to content

Pythagorean Theorem Calculator

Pick the side you are missing, enter the other two, and get it from a² + b² = c²: as an exact simplified root when your sides are whole numbers, as a decimal, and with the triangle's angles, area and perimeter worked out. Unlike a general scientific calculator, it keeps the root exact, shows each step and tells you if the sides form a Pythagorean triple.

Solve for

The hypotenuse c is the longest side, opposite the right angle. Any length unit works, as long as both sides use the same one.

Result

Hypotenuse c

c = 5

Angle αOpposite leg a
36.8699°
Angle βOpposite leg b
53.1301°
Area (square units)
6
Perimeter
12
Height to the hypotenuseFrom the right angle, a × b ÷ c
2.4
Pythagorean triple
3-4-5 (primitive)
Show the working
  1. Square the legs and add themc² = a² + b² = 3² + 4² = 9 + 16 = 25
  2. Take the square rootc = √25 = 5
  3. Angle opposite aα = arctan(a ÷ b) = arctan(3 ÷ 4) = 36.8699°
  4. The acute angles add up to 90°β = 90° − 36.8699° = 53.1301°
  5. Area: half the product of the legsa × b ÷ 2 = 3 × 4 ÷ 2 = 6
  6. Perimeter: sum of the three sidesa + b + c = 3 + 4 + 5 = 12

Squares and exact roots are worked out from the digits you typed, without rounding. Decimals are shown to about 10 significant digits and angles to 4 decimal places.

How to use the calculator

A right triangle has one 90° angle. The two sides that form it are the legs, a and b; the side opposite it is the hypotenuse, c, always the longest. Choose which of the three you want, type the other two, and the calculator returns:

  • the missing side, both as an exact value and as a decimal. With whole-number inputs the root is simplified, so √50 is shown as 5√2;
  • the two acute angles, α opposite a and β opposite b;
  • the area, the perimeter and the height from the right angle to the hypotenuse;
  • whether the three sides form a Pythagorean triple such as 3-4-5, and which basic triple it multiplies;
  • each step with your numbers, and a sketch of your triangle in its real proportions.

Lengths can be in any unit as long as both are in the same one; the answer comes out in that unit and the area in its square.

The formula

a² + b² = c²

a, b
the legs, the two sides that meet at the right angle
c
the hypotenuse, opposite the right angle

Rearranged for each side:

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

Because c² is a sum of two positive squares, the hypotenuse is always longer than either leg. If you enter a leg that is as long as the hypotenuse, or longer, no right triangle exists and the calculator says so.

The rest follows from the three sides:

α = arctan(a ÷ b)   β = 90° − α   area = a × b ÷ 2   height = a × b ÷ c

Simplifying the root. When c² is not a perfect square, the largest square factor is taken out of the root: 50 = 5² × 2, so √50 = 5√2. This is done only for whole-number sides.

Accuracy. The hypotenuse is computed with a scaled square root (JavaScript's Math.hypot) that does not overflow or underflow for very large or very small sides. A leg is computed as √((c − b)(c + b)), which is algebraically c² − b² but does not subtract two huge nearly equal squares: for c = 100,000,001 and b = 100,000,000 the direct subtraction in ordinary floating point gives 200,000,000 instead of 200,000,001.

Worked examples

Legs 3 and 4 (the default). c² = 3² + 4² = 9 + 16 = 25, so c = √25 = 5. The angle opposite the leg of 3 is arctan(3 ÷ 4) ≈ 36.8699°, the other is 90° − 36.8699° ≈ 53.1301°. The area is 3 × 4 ÷ 2 = 6, the perimeter 3 + 4 + 5 = 12, and the height to the hypotenuse 3 × 4 ÷ 5 = 2.4. Since all three sides are whole numbers, 3-4-5 is a Pythagorean triple, and a primitive one because 3, 4 and 5 share no common factor.

Legs 5 and 5. c² = 25 + 25 = 50, which is not a perfect square. 50 = 25 × 2, so c = √50 = 5√2 ≈ 7.0710678119. Both angles are 45°.

A missing leg. A ladder 13 feet long reaches a point on a wall with its foot 5 feet from the wall. The ladder is the hypotenuse, so the height is √(13² − 5²) = √(169 − 25) = √144 = 12 feet, the 5-12-13 triple.

Pythagorean triples

A Pythagorean triple is three whole numbers that satisfy a² + b² = c². A triple is primitive when the three have no common factor; every other triple is a multiple of a primitive one, so 6-8-10 is 2 × (3-4-5) and 9-12-15 is 3 × (3-4-5). Common primitive triples are 3-4-5, 5-12-13, 8-15-17, 7-24-25 and 20-21-29.

Euclid gave a way to generate them: for whole numbers m > n > 0, the sides m² − n², 2mn and m² + n² always form a triple. m = 2 and n = 1 give 3-4-5; m = 3 and n = 2 give 5-12-13.

Tips and common mistakes

  • Find the hypotenuse first. It is the side across from the right angle, not simply the side you were not given. Putting a leg in the c slot is the most common error.
  • Square before adding. √(3² + 4²) is 5; √3 + √4 is not, and neither is 3 + 4.
  • Checking a corner is square. Builders mark 3 units along one wall and 4 along the other; if the diagonal between the marks is exactly 5, the corner is 90°. Multiples such as 6-8-10 feet work the same way for larger layouts. The square footage calculator can then give the floor area.
  • Only for right triangles. For other triangles the sides are linked by the law of cosines, which this calculator does not cover. Roots and trigonometric functions for other problems are in the scientific calculator.

Limits

Sides can be from just above 0 up to 10¹⁵ in any one unit. The exact root is simplified only when the sides are whole numbers and c² stays below about 9 × 10¹⁵; above that the unsimplified root and the decimal are shown. Measured lengths carry their own error, so round the answer to the precision of your measurements.

Frequently asked questions

How do I find the hypotenuse of a right triangle?

Square each leg, add the squares and take the square root: c = √(a² + b²). With legs 6 and 8, c = √(36 + 64) = √100 = 10.

How do I find a missing leg?

Subtract the square of the known leg from the square of the hypotenuse and take the square root: a = √(c² − b²). With c = 13 and b = 5, a = √(169 − 25) = √144 = 12.

Why does the calculator say the hypotenuse must be longer?

In a right triangle c² = a² + b², and both squares are positive, so c is longer than each leg. If the leg you enter is equal to or longer than the hypotenuse, no right triangle has those sides; check that the longest side is in the hypotenuse field.

What is a Pythagorean triple?

Three whole numbers that fit a² + b² = c², such as 3-4-5 or 5-12-13. Multiplying a triple by any whole number gives another one, so 6-8-10 and 9-12-15 are triples too. A triple with no common factor is called primitive.

Does the Pythagorean theorem work for any triangle?

No, only when one angle is exactly 90°. If a² + b² is larger than c² the angle opposite c is acute, and if it is smaller that angle is obtuse; for such triangles use the law of cosines.

Sources

Last reviewed September 19, 2026