Skip to content
PercentPoint

Pythagorean Theorem Calculator

Find the missing side of a right triangle from the other two, with the exact square root, area, perimeter and angles, or check whether three side lengths form a right triangle.

For planning only. Your school, syllabus or accountant has the final word. First published · Last reviewed by PercentPoint.

How to use the Pythagorean theorem calculator

  1. Choose what to solve for. “Hypotenuse c” needs both legs. “Leg a” or “Leg b” needs the other leg and the hypotenuse. “Is it right?” takes any three sides and tells you what kind of triangle they make.
  2. Enter the known sides in one unit. Inches, feet, meters or plain numbers all work, as long as every side uses the same unit. The answer comes out in that unit.
  3. Read the results. The large figure is the missing side to four decimal places. Underneath you’ll see the exact form, such as 5√2, when the inputs are whole numbers, or a note when all three sides are whole numbers. The cards list all three sides, the area, the perimeter and the two acute angles.

The diagram is drawn to scale and highlights the side you are solving for.

The formula

In a right triangle, the two sides that form the right angle are the legs, a and b. The side opposite the right angle is the hypotenuse, c, and it is the longest side. The Pythagorean theorem says:

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

The examples in OpenStax’s Prealgebra 2e (section 9.3) are reproduced by this calculator:

  • Legs 3 and 4. c² = 9 + 16 = 25, so c = 5.
  • Leg 5, hypotenuse 13. b² = 169 − 25 = 144, so b = 12.
  • A 13-foot ladder with its base 5 feet from a wall reaches √(169 − 25) = 12 feet up the wall.
  • A 10-inch brace with two equal legs. x² + x² = 100, so x = √50 ≈ 7.1 inches. Enter legs of 7.0711 to confirm the hypotenuse comes back as 10.

A common slip is to subtract when you should add, or the reverse. If you are finding the hypotenuse, add the squares. If you are finding a leg, subtract the smaller square from the hypotenuse’s square. If the “hypotenuse” you entered isn’t longer than the leg, the calculator stops and tells you, because no right triangle has that shape.

Exact answers and simplified square roots

Most missing sides aren’t whole numbers. Legs of 1 and 1 give c = √2 ≈ 1.4142. When the sides you enter are whole numbers, the calculator also shows the exact answer in simplest radical form by pulling out the largest perfect square: √50 = √(25 × 2) = 5√2, √72 = √(36 × 2) = 6√2 and √45 = √(9 × 5) = 3√5. Teachers often want this form on homework, so it saves a factoring step.

When all three sides are whole numbers, they form a Pythagorean triple. The familiar ones are 3-4-5, 5-12-13, 8-15-17 and 7-24-25. Multiplying a triple by any whole number gives another one, so 6-8-10 and 9-12-15 are also right triangles.

Angles, area and perimeter

Once all three sides are known, the rest of the triangle follows:

  • Area = a × b ÷ 2, because the legs are the base and height. For 3-4-5 that is 6 square units.
  • Perimeter = a + b + c. For 3-4-5 that is 12.
  • Angles. The angle opposite leg a is arctan(a ÷ b), and the other acute angle is 90° minus that. For 3-4-5 the angles are about 36.87° and 53.13°. Equal legs give 45° and 45°.

Checking whether a triangle is a right triangle

The theorem also works in reverse: if the two shorter sides squared add up to the longest side squared, the triangle has a right angle. Builders use this as the 3-4-5 rule to check that a corner is square. Mark 3 feet along one wall and 4 feet along the other; if the diagonal between the marks is exactly 5 feet, the corner is 90°. For more accuracy over a bigger area, use 6-8-10 or 9-12-15.

The “Is it right?” mode goes one step further. The Law of Cosines, c² = a² + b² − 2ab cos γ, is the general form of the theorem for any triangle. When the longest side squared is less than the sum of the other two squares, the largest angle is under 90° and the triangle is acute. When it is more, that angle is over 90° and the triangle is obtuse. Sides of 4, 5 and 6 give 16 + 25 = 41 against 36, so the triangle is acute; 2, 3 and 4 give 4 + 9 = 13 against 16, so it is obtuse.

Three lengths only make a triangle if the two shorter ones add up to more than the longest. 1, 2 and 3 fail, because 1 + 2 is only equal to 3 and the “triangle” would lie flat.

Practical examples

  • Screen size. TVs and monitors are sold by the diagonal. A screen 48 inches wide and 27 inches tall has a diagonal of √(2,304 + 729) ≈ 55.07 inches. The aspect ratio calculator goes the other way, from diagonal to width and height.
  • Ramps and roofs. A ramp that rises 2 feet over a 24-foot run is √(4 + 576) ≈ 24.08 feet long along the surface.
  • Straight-line distance. Walking 300 meters east and then 400 meters north puts you 500 meters from where you started.

Round the answer to match your measurements. If you measured to the nearest quarter inch, four decimal places suggest a precision you don’t have.

Distances on a grid and in three dimensions

The distance between two points on a graph is a Pythagorean problem in disguise. From (1, 2) to (7, 10), the horizontal change is 6 and the vertical change is 8, so the distance is √(36 + 64) = √100 = 10. Enter 6 and 8 as the legs to check it.

For a box, apply the theorem twice. A box 3 feet long, 4 feet wide and 12 feet tall has a floor diagonal of √(9 + 16) = 5 feet. That diagonal and the height form a second right triangle, so the longest straight line inside the box is √(25 + 144) = 13 feet. In one step, the space diagonal is √(length² + width² + height²). Run the calculator once with 3 and 4, then again with 5 and 12, to see both stages.

Sources & assumptions

How this calculator gets its numbers. Full method: our methodology.

  • a and b are the legs that meet at the right angle and c is the hypotenuse, so c² = a² + b², a = √(c² − b²) and b = √(c² − a²).
  • Exact answers are shown as a simplified square root when the sides you enter are whole numbers.
  • The triangle check compares the two shorter sides squared with the longest side squared; by the Law of Cosines a larger longest side means an angle over 90°.

Sources

  1. OpenStax (Rice University), Prealgebra 2e, 9.3 Use Properties of Angles, Triangles, and the Pythagorean Theorem. a² + b² = c² for a right triangle, with Example 9.22 (legs 3 and 4, hypotenuse 5), Example 9.23 (leg 5, hypotenuse 13, other leg 12), Example 9.24 (a 10-inch brace with equal legs of about 7.1 inches) and Try It 9.47 (a 13-foot ladder 5 feet from the wall reaches 12 feet).
  2. OpenStax (Rice University), Algebra and Trigonometry 2e, 10.2 Non-right Triangles: Law of Cosines. Law of Cosines for SAS and SSS (Examples 1, 2 and 4) and Heron’s formula (Example 5: area ≈ 29.4).

Last reviewed . Measurements carry their own error; round the answer to the precision of your tape or ruler.

Frequently asked questions

What is the Pythagorean theorem?

In a right triangle, the square of the hypotenuse equals the sum of the squares of the two legs: a² + b² = c². It only applies to triangles with a 90° angle.

How do I find the hypotenuse?

Square both legs, add them and take the square root. Legs of 3 and 4 give √(9 + 16) = √25 = 5.

How do I find a missing leg?

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

Which side is the hypotenuse?

The side opposite the right angle. It is the longest side of a right triangle, so it is the only side that can be c.

Does the Pythagorean theorem work for any triangle?

No, only right triangles. For other triangles use the Law of Cosines, c² = a² + b² − 2ab cos γ, which reduces to the Pythagorean theorem when γ is 90°.

What are Pythagorean triples?

Sets of three whole numbers that fit a² + b² = c², such as 3-4-5, 5-12-13, 8-15-17 and 7-24-25. Any whole-number multiple, like 6-8-10, is also a triple.