EN

Pythagorean theorem calculator

Enter two of the three sides of a right triangle and leave the unknown side empty. The calculator finds the missing side and also gives the area, perimeter and both acute angles.

Pythagorean theorem

Enter any two sides and leave the unknown one empty.

Use a point for decimals, e.g. 12.5.

Fill in the fields and press Calculate. The calculator needs JavaScript; the explanation and formula below always work.

The Pythagorean theorem

In a right triangle (a triangle with a 90-degree angle):

a² + b² = c²

Here a and b are the two legs, the sides that form the right angle. c is the hypotenuse, the longest side, opposite the right angle. The theorem is named after the Greek mathematician Pythagoras, although the Babylonians and others knew the relationship earlier.

Finding the missing side

  • Hypotenuse: c = √(a² + b²)
  • Leg: a = √(c² − b²) or b = √(c² − a²)

Note that the hypotenuse is always the longest side. If you enter a hypotenuse shorter than a leg, the calculator shows a warning.

Worked examples

  • a = 3 and b = 4: c = √(9 + 16) = √25 = 5, the best-known Pythagorean triple.
  • a = 5 and b = 12: c = √(25 + 144) = √169 = 13.
  • A 10-foot ladder leans against a wall and reaches 8 feet high. How far is its foot from the wall? √(10² − 8²) = √(100 − 64) = √36 = 6 feet.
  • A 55-inch TV (the diagonal) with a 16:9 ratio is about 47.9 inches wide and 27 inches tall.

Other results

Besides the missing side, the calculator shows:

  • Area: a × b / 2, since a right triangle is half a rectangle.
  • Perimeter: a + b + c.
  • Angles: the two acute angles α and β, found with the tangent. Together they always add up to 90 degrees.

The theorem in practice

  • Laying out a square corner: builders and landscapers use the 3-4-5 method. Measure 3 feet along one side and 4 feet along the other; if the distance between those points is exactly 5 feet, the corner is square. Larger multiples such as 6-8-10 are more accurate.
  • Diagonals: the diagonal of a room, a screen or a yard follows from the theorem. Use it to check that a foundation or deck is truly rectangular: both diagonals must be equal.
  • Roof pitch and stairs: the length of a rafter or stair stringer follows from the rise and the run.
  • Distance on a grid: the straight-line distance between two points on a grid map is √(Δx² + Δy²).

Pythagorean triples

Some sets of whole numbers fit the theorem exactly, such as 3-4-5, 5-12-13, 8-15-17 and 7-24-25. All multiples work too: 6-8-10, 9-12-15. These triples are handy in homework and for laying out right angles without a calculator.

A quick proof

One classic proof uses a large square with side a + b. Place four copies of the triangle inside it, with their hypotenuses forming a tilted square in the middle. The large square's area is (a + b)², which equals the four triangles (4 × ab / 2 = 2ab) plus the inner square c². Expanding gives a² + 2ab + b² = 2ab + c², so a² + b² = c².

In three dimensions

The theorem also works in 3D. The space diagonal of a box with length l, width w and height h is √(l² + w² + h²). A box of 3 × 4 × 12 has a diagonal of √(9 + 16 + 144) = √169 = 13, which tells you whether a long object will fit diagonally inside.

Frequently asked questions

How do I find the hypotenuse?

Square both legs, add them and take the square root: c = √(a² + b²).

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²).

Does the theorem work for every triangle?

No, only for right triangles. For other triangles, use the law of cosines.

What is the hypotenuse?

The longest side of a right triangle, opposite the right angle.

How do I check that a corner is square?

Use the 3-4-5 method: measure 3 and 4 units along the sides; the diagonal must be exactly 5.

How do I find the diagonal of a rectangle?

Use the length and width as a and b: diagonal = √(length² + width²). A 12 × 9 ft room has a 15 ft diagonal.

Last reviewed: 2026-10-06. Results are estimates for information only.

Related calculators