Pythagorean Theorem Calculator

About this calculator

The Pythagorean Theorem Calculator finds the missing side of a right triangle from the other two using a² + b² = c². Enter legs a and b to get the hypotenuse c, or enter the hypotenuse and one leg to get the other leg. You get the answer as an exact square root where possible (for example √74) and as a decimal, with every step shown.

It also reports both acute angles, the area, the perimeter and the height to the hypotenuse. Each side has an optional √ box, so you can enter values like 13√5 directly.

Enter any two sides
Optional: a = value × √(this)
Embed this calculator

Paste this code into a Custom HTML block on your site. The calculator fits the width of the block. Adjust the height in the code if you want more room for results.

Find this widget in the publisher directory

The Pythagorean theorem

In any right triangle, the square of the hypotenuse equals the sum of the squares of the two legs:

a² + b² = c²

Here a and b are the legs, the two sides that meet at the right angle, and c is the hypotenuse, the longest side, opposite the right angle. Rearranging gives a formula for whichever side is missing:

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

The theorem only applies to right triangles. For other triangles, the law of cosines adds a correction term, c² = a² + b² − 2ab · cos C, which becomes the Pythagorean theorem when C is 90°.

Worked examples

Finding the hypotenuse

With legs a = 5 and b = 7: c² = 25 + 49 = 74, so c = √74 ≈ 8.6023252670426. Because 74 has no square factor, √74 is already in simplest form. The area is 5 × 7 / 2 = 17.5 and the height to the hypotenuse is 35 / √74, which simplifies to 35√74 / 74 ≈ 4.0686673560337.

Finding a leg

With leg b = 5 and hypotenuse c = 13√5: c² = 169 × 5 = 845, so a² = 845 − 25 = 820. Since 820 = 4 × 205, a = 2√205 ≈ 28.635642126553.

Simplifying square roots

An exact answer is often more useful than a long decimal. To simplify √N, pull out the largest perfect square that divides N: √72 = √(36 × 2) = 6√2. The calculator does this automatically whenever the inputs are whole numbers (optionally times a square root), and it also rationalizes denominators, so a result like 10 / √5 is shown as 2√5.

Pythagorean triples

A Pythagorean triple is a set of three whole numbers that satisfy a² + b² = c². Multiplying any triple by a whole number gives another one (6, 8, 10 from 3, 4, 5). Common primitive triples:

abc
345
51213
81517
72425
202129
94041

Why it works

One classic proof arranges four copies of the right triangle inside a large square with side a + b, leaving a tilted square of side c in the middle. The big square's area can be written two ways: (a + b)² and c² + 4 × (ab / 2). Expanding gives a² + 2ab + b² = c² + 2ab, and cancelling 2ab leaves a² + b² = c².

Everyday uses

Carpenters check that a corner is square by measuring 3 units along one wall, 4 along the other and confirming the diagonal is 5. The same idea finds the diagonal of a TV screen, the length of a ladder needed to reach a window, the straight-line distance between two points on a map grid, or the length of a roof rafter from its run and rise. The distance formula in coordinate geometry is simply the Pythagorean theorem applied to the horizontal and vertical differences.

Using the theorem in three dimensions

The theorem extends naturally to boxes and other 3D shapes. The space diagonal of a rectangular box with sides l, w and h is √(l² + w² + h²), found by applying a² + b² = c² twice: first across the floor of the box, then up to the opposite top corner. A box that is 3 by 4 by 12 has a floor diagonal of 5 and a space diagonal of √(25 + 144) = 13. The same idea gives the distance formula in 3D coordinates.

Checking whether a triangle is a right triangle

The converse of the theorem is just as useful: if the squares of the two shorter sides add up to the square of the longest side, the triangle must contain a right angle. If the sum is larger, the triangle is acute; if it is smaller, the triangle is obtuse. For sides 6, 7 and 9, 36 + 49 = 85, which is more than 81, so that triangle is acute.

Frequently asked questions

What is the Pythagorean theorem formula?
a² + b² = c², where a and b are the legs of a right triangle and c is the hypotenuse.
How do I find a leg instead of the hypotenuse?
Subtract the square of the known leg from the square of the hypotenuse and take the square root: a = √(c² − b²).
Does the Pythagorean theorem work for all triangles?
No, only for right triangles. For any other triangle use the law of cosines, c² = a² + b² − 2ab · cos C.
What is the hypotenuse of a triangle with legs 5 and 7?
√74, which is about 8.6023.

Formulas and sample results on this page were checked against independent references. Page last reviewed or updated . How we verify calculators. Project led by Shaun Connell.