Pythagorean Theorem Calculator

Solve a right triangle with a² + b² = c² — find the hypotenuse or a missing leg, plus area and perimeter.

Written by Ahmet Tur · Reviewed by Kübra Yıldız · Updated

Your result will appear here

Fill in the fields and press Calculate.

The Pythagorean theorem says that in a right triangle, a² + b² = c², where c is the hypotenuse (the side opposite the 90° angle). To find the hypotenuse, square both legs, add them and take the square root: legs of 6 and 8 give c = √(36 + 64) = √100 = 10. To find a missing leg, subtract instead: b = √(c² − a²).

This calculator solves either case. Choose "Hypotenuse" and enter both legs, or choose "A leg" and enter the hypotenuse as side a and the known leg as side b. Alongside the missing side it gives the triangle's area (½ × leg × leg) and perimeter, to six decimal places.

The theorem only applies to right triangles. Below are the rearranged formulas, the whole-number triples used on job sites, practical U.S. examples (ladders, TV screens, rafters, squaring a deck) and the mistakes that produce impossible answers.

Pythagorean Theorem Calculator: step-by-step worked example

How long a ladder must be to reach 4 m up a wall with its foot 1.5 m out

Example inputs
Find
Hypotenuse (from two legs)
Side a (leg, or hypotenuse in leg mode)
1.5
Side b (the other known side)
4
  1. 1

    Square the known sides

    a² and b²

    1.5² = 2.25 · 4² = 16 = 2.25 m² · 16 m²

  2. 2

    Pythagorean relation

    c² = a² + b² (hypotenuse) · leg² = c² − other leg² (leg)

    2.25 + 16 = 18.25 m²

  3. 3

    Take the square root

    Missing side = √(…)

    √18.25 = 4.272 m

  4. 4

    Triangle area

    Area = leg × leg ÷ 2

    1.5 × 4 ÷ 2 = 3 m²

  5. 5

    Triangle perimeter

    Perimeter = a + b + c

    1.5 + 4 + 4.272 = 9.772 m

Result · Missing side4.272 m
Hypotenuse² = sum of the legs²
  • 1st leg²2.25 m²12.3%
  • 2nd leg²16 m²87.7%

Good to know: Valid only for right triangles. For a safe ladder angle, set the foot about 1/4 of the working height from the wall (the 4:1 rule). The hypotenuse is always the longest side.

Pythagorean Theorem Calculator — how it works

The three forms of the formula

You knowYou wantFormula
Both legs a and bHypotenuse cc = √(a² + b²)
Hypotenuse c and leg aLeg bb = √(c² − a²)
Hypotenuse c and leg bLeg aa = √(c² − b²)

In "A leg" mode the hypotenuse must be longer than the known leg, or c² − a² is negative and no triangle exists. The calculator rejects that input instead of returning an error value. The result has the same unit as the inputs: enter feet, get feet.

Because the two legs of a right triangle are perpendicular, they serve as base and height. That makes the area simply ½ × a × b, and the perimeter a + b + c.

Why it works

Euclid's Elements states it as Proposition I.47: "In right-angled triangles the square on the side opposite the right angle equals the sum of the squares on the sides containing the right angle." The squares are literal: draw a square on each side, and the two smaller squares have the same total area as the largest. Euclid's next proposition, I.48, is the converse: if the squares on two sides add up to the square on the third, the angle between those two sides is a right angle. That converse is what builders use to check a corner.

Pythagorean triples worth remembering

Whole-number solutions make field work easy because there is no square root to estimate.

abcMultiples
3456-8-10, 9-12-15, 12-16-20
5121310-24-26
8151716-30-34
7242514-48-50
202129—

Any multiple of a triple is also a triple. A 6-8-10 or 12-16-20 is easier to measure accurately with a tape than 3-4-5, because measurement errors are a smaller share of a longer distance.

Everyday U.S. uses

  • Squaring a deck, slab or wall layout. Mark 6 ft along one edge and 8 ft along the other; the diagonal between the marks should be exactly 10 ft. If it is longer, the angle is more than 90°; shorter, less.
  • Ladder placement. OSHA's construction standard (29 CFR 1926.1053) says non-self-supporting ladders should be set so the horizontal distance from the top support to the foot is about one quarter of the working length. The theorem then tells you how high the ladder reaches.
  • TV and monitor size. Screens are sold by diagonal. A 16:9 screen has sides in the ratio 16:9 and a diagonal of √(16² + 9²) = √337 ≈ 18.36 units, so a 65-inch TV is about 65 × 16 ÷ 18.36 ≈ 56.7 in wide and 65 × 9 ÷ 18.36 ≈ 31.9 in tall.
  • Roof rafters. For a run of 12 ft and a rise of 5 ft (a 5/12 pitch), the rafter length before overhang is √(144 + 25) = √169 = 13 ft.
  • Straight-line distance on a grid. Walking 3 blocks east and 4 blocks north puts you 5 block-lengths away as the crow flies. The same idea gives the distance formula between two points: d = √((x₂ − x₁)² + (y₂ − y₁)²).

Common mistakes

  • Adding before squaring. √(3 + 4) is not 5. Square each side first, then add, then take the root.
  • Using a leg as the hypotenuse. The hypotenuse is always the longest side and is opposite the right angle. If your "hypotenuse" is shorter than a leg, the labels are swapped.
  • Subtracting the wrong way. For a missing leg it is c² − a², never a² − c².
  • Applying it to non-right triangles. For any other triangle you need the law of cosines, c² = a² + b² − 2ab·cos(C), which reduces to the Pythagorean theorem when C = 90° because cos 90° = 0.
  • Mixing units. A leg in feet and another in inches gives nonsense. Convert first (12 in = 1 ft).

3D extension

The theorem extends to boxes. The space diagonal of a box measuring l × w × h is √(l² + w² + h²). A 4 ft × 3 ft × 12 ft space has a diagonal of √(16 + 9 + 144) = √169 = 13 ft, which tells you whether a long board or pipe will fit inside a room or truck bed. Run the calculator twice to get the same answer: first the floor diagonal from 4 and 3 (5 ft), then the hypotenuse from 5 and 12 (13 ft).

Entering values in the calculator

In "Hypotenuse" mode, a and b are the two legs and their order doesn't matter: 6 and 8 give the same 10 as 8 and 6. In "A leg" mode, a must be the hypotenuse and b the leg you know; if you swap them, the calculator rejects the input because a leg can't be longer than the hypotenuse.

The area and perimeter are calculated for the whole right triangle in both modes. Use the same unit for both inputs. If one side is 5 ft 6 in, enter 5.5 ft, not 5.6.

Exact vs decimal answers

Most right triangles don't have whole-number sides, so the missing side is often an irrational number shown here to six decimals. Legs of 1 and 1 give √2 = 1.414214; legs of 1 and 2 give √5 = 2.236068; legs of 2 and 3 give √13 = 3.605551. A math class may expect the answer in radical form (√13); a carpenter will round 3.605551 ft to 3 ft 7¼ in (0.605551 × 12 = 7.27 in).

Worked example

A homeowner has a 24-ft extension ladder and wants to know how high up the wall it will reach when set at the safe angle.

Following OSHA's one-quarter guideline, the foot of the ladder goes about 24 ÷ 4 = 6 ft from the wall. The ladder is the hypotenuse, so choose "A leg" mode and enter a = 24 (hypotenuse) and b = 6 (known leg):

  • Height reached: √(24² − 6²) = √(576 − 36) = √540 = 23.2379 ft, about 23 ft 3 in
  • Area of the triangle formed: ½ × 6 × 23.2379 = 69.7137 sq ft
  • Perimeter: 6 + 23.2379 + 24 = 53.2379 ft

The working length of an extension ladder is less than its nominal length because the sections overlap, so the real reach will be a little lower. OSHA also requires side rails to extend at least 3 ft above an upper landing that the ladder is used to access, which means this ladder can serve a landing up to about 20 ft high, not 23.

To check that the ladder base is square to a level wall, the same theorem works in reverse: measure 3 ft along the ground and 4 ft up the wall from the corner. The diagonal between those marks should read 5 ft.

Frequently asked questions

How do you find the hypotenuse of a right triangle?+

Square both legs, add them and take the square root: c = √(a² + b²). Legs of 5 and 12 give √(25 + 144) = √169 = 13.

How do you find a missing side of a right triangle?+

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

What is the hypotenuse of a 1 by 1 right triangle?+

√(1 + 1) = √2 ≈ 1.414214. That is why the diagonal of a square is always about 1.414 times its side.

Does the Pythagorean theorem work for all triangles?+

No, only for right triangles. For other triangles use the law of cosines, c² = a² + b² − 2ab·cos(C), which becomes a² + b² = c² when the angle C is 90°.

What is the 3-4-5 rule in construction?+

If one side measures 3 units, the adjacent side 4 units and the diagonal between their ends exactly 5 units, the corner is a right angle. Builders often use multiples such as 6-8-10 ft for better accuracy.

How tall is a 65-inch TV?+

For a 16:9 screen, height = diagonal × 9 ÷ √337 ≈ 65 × 0.490 = 31.9 in, and width ≈ 65 × 0.872 = 56.7 in. Add a little for the bezel.

How high will a 24-foot ladder reach?+

Set at the OSHA one-quarter angle (foot 6 ft from the wall), the top reaches √(24² − 6²) ≈ 23.2 ft. Overlap between extension sections reduces the real working length.

What are Pythagorean triples?+

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

How do I find the diagonal of a rectangle?+

The diagonal is the hypotenuse of a right triangle formed by the length and width: d = √(l² + w²). A 12 × 16 ft room has a diagonal of √(144 + 256) = 20 ft.

Sources

About this page

Publisher:
Kalkoro — Teknolojig Bilişim Teknolojileri A.Ş., İstanbul
Written by:
Ahmet Tur — Editor (Math, date & time, unit conversion, physics & chemistry, everyday tools)
Reviewed by:
Kübra Yıldız — Editor

Parameters come from official sources; the last update date is shown at the bottom of the page.

Spotted a wrong result? Use the "Report a bug" button at the top of the page; every report is reviewed.

How we calculate and our accuracy policy →

Results are for information only. For official matters the relevant authority's calculation prevails.

Last updated: