Skip to content

Pythagorean Theorem Calculator

Solve for a missing leg or hypotenuse, verify whether three lengths form a right triangle, and see exact radicals, steps, angles, area, and perimeter.

Use one unit for every side. The selector labels results but does not convert mixed units.

Enter the known right-triangle sides to calculate or verify the missing length.

How to Use the Pythagorean Theorem Calculator

Choose whether to find hypotenuse c, find side a, find side b, or check three entered side lengths.

Enter the known positive lengths. The two legs a and b meet at the right angle, while c is the hypotenuse opposite the right angle.

Choose an optional unit label and the number of decimal places to display.

The result includes the requested side or verification, a compact calculation, a proportional diagram, and additional right-triangle measurements.

Calculator modes

Calculator modes
ModeEnterFormulaRequirement
Find hypotenuse cLegs a and bc = √(a² + b²)Both legs must be positive
Find side aLeg b and hypotenuse ca = √(c² − b²)c must be longer than b
Find side bLeg a and hypotenuse cb = √(c² − a²)c must be longer than a
Check three sidesa, b, and proposed cCompare a² + b² with c²c must be longest and a + b must exceed c

Swipe horizontally to view the full table.

What the Pythagorean Theorem Says

For a right triangle, the sum of the squares of the two legs equals the square of the hypotenuse.

The relationship is written a² + b² = c², where c is always opposite the 90-degree angle.

Because c² contains both positive squared legs, c must be longer than either individual leg.

The equation connects side lengths only when a and b are perpendicular.

Finding the Hypotenuse

When both legs are known, add their squares and take the positive square root.

For legs 3 and 4, c = √(3² + 4²) = √25 = 5.

Only the positive square root is used because a geometric length cannot be negative.

Worked 3–4–5 example

Worked 3–4–5 example
StepOperationResult
Identify the legsa = 3 and b = 4c is unknown
Apply the theoremc = √(a² + b²)c = √(3² + 4²)
Square the legs3² + 4²9 + 16 = 25
Take the positive rootc = √25c = 5
Calculate areaA = ab ÷ 2A = 6 square units
Calculate perimeterP = a + b + cP = 12 units

Swipe horizontally to view the full table.

Finding a Missing Leg

When the hypotenuse and one leg are known, rearrange the theorem before taking the square root.

To find a, use a = √(c² − b²). To find b, use b = √(c² − a²).

The entered hypotenuse must be longer than the known leg. Otherwise the subtraction cannot produce a positive side length.

For b = 12 and c = 13, a = √(169 − 144) = √25 = 5.

Checking Whether Three Sides Form a Right Triangle

The converse of the theorem allows three side lengths to be tested.

Place the longest side in c and compare a² + b² with c².

When they are equal within floating-point tolerance, the calculator reports a right triangle.

When they differ, the calculator shows the hypotenuse required by the two entered legs.

The tool first checks the triangle inequality, because three lengths that cannot form any triangle should not be treated merely as a non-right triangle.

Exact Radical and Decimal Results

Some side lengths are whole numbers, while others are irrational.

For legs 1 and 1, the exact hypotenuse is √2. The displayed decimal 1.4142 is an approximation.

When the squared expression is a supported safe integer, the calculator simplifies square factors. For example, √8 becomes 2√2.

Keep the radical form during symbolic work when possible and round the decimal only when a measured result is needed.

Exact and decimal hypotenuse results

Exact and decimal hypotenuse results
Legs a and bExact cApproximate cResult type
3 and 455Whole-number result
1 and 1√21.4142Irrational result
2 and 22√22.8284Simplified radical
5 and 6√617.8102Irrational result

Swipe horizontally to view the full table.

Pythagorean Triples

A Pythagorean triple is a set of positive whole numbers that satisfies a² + b² = c² exactly.

The best-known example is 3–4–5.

Multiplying every side by the same positive number preserves the proportions and creates another right triangle, such as 6–8–10.

Triples are convenient for layout checks and examples, but right-triangle sides do not need to be integers.

Common Pythagorean triples

Common Pythagorean triples
TripleVerificationScaled examplesCommon use
3–4–59 + 16 = 256–8–10; 9–12–15Fast square-corner checks
5–12–1325 + 144 = 16910–24–26Construction and surveying
8–15–1764 + 225 = 28916–30–34Compact integer triangle
7–24–2549 + 576 = 62514–48–50Geometry and layout work
20–21–29400 + 441 = 84140–42–58Triangles with similar legs
12–35–37144 + 1,225 = 1,36924–70–74Larger exact measurements

Swipe horizontally to view the full table.

Area, Perimeter, and Acute Angles

After all three sides are known, the calculator also derives the triangle’s area, perimeter, and two acute angles.

Area is ab ÷ 2 because either leg can act as the base and the other as its perpendicular height.

Perimeter is a + b + c.

The acute angle opposite a is calculated with atan(a ÷ b), and the angle opposite b uses atan(b ÷ a). Together with the 90-degree angle, they total 180 degrees.

Where the Theorem Is Useful

The theorem applies whenever two perpendicular measurements determine a direct diagonal.

Common examples include rectangular frames, screens, ramps, ladders, roofs, coordinate distances, vector magnitudes, and square-corner checks.

The right angle must come from the geometry of the problem rather than being assumed merely because three lengths are available.

Practical Pythagorean theorem applications

Practical Pythagorean theorem applications
ApplicationPerpendicular legsCalculated valueExample
Square a layoutPerpendicular measurements from one cornerRequired diagonal3–4–5 confirms a 90° corner
Ramp, ladder, or roofHorizontal run and vertical riseSloped length6 m run and 2 m rise require √40 m
Rectangle or displayWidth and heightCorner-to-corner diagonal9 by 12 gives a diagonal of 15
Coordinate distanceHorizontal and vertical coordinate changesStraight-line distanceΔx = 6 and Δy = 8 gives distance 10
Two-dimensional vectorPerpendicular vector componentsVector magnitudeComponents 5 and 12 give magnitude 13

Swipe horizontally to view the full table.

The Distance Formula

On a flat coordinate plane, the horizontal change Δx and vertical change Δy are perpendicular.

They form the legs of a right triangle whose hypotenuse is the straight-line distance between the points.

This gives d = √((x₂ − x₁)² + (y₂ − y₁)²), which is the Pythagorean theorem written with coordinate differences.

Using the 3–4–5 Method to Check a Corner

Measure three equal units along one edge and four along the other.

When the distance between those marks is five of the same units, the measurements form a 3–4–5 right triangle.

Larger scaled versions such as 6–8–10 can be easier to measure accurately.

Real layout work still requires suitable tolerances, tools, reference lines, and safety practices.

Units and Scaling

Every side must use the same unit before the theorem is applied.

Do not enter one side in feet and another in inches unless one is converted first.

The unit selector only labels the answer. It does not alter the numerical values.

Multiplying every side by the same positive scale factor creates a similar right triangle. Lengths scale linearly, perimeter scales linearly, and area scales by the square of the factor.

Precision and Measurement

The formulas can be exact while the entered measurements are approximate.

A tape measure, drawing, coordinate reading, or instrument may already include rounding and uncertainty.

Choose decimal precision that matches the source measurements rather than presenting unsupported extra digits.

Avoid rounding an intermediate side before using it in another area, angle, or construction calculation.

Numerical Stability

The calculator uses Math.hypot when finding the hypotenuse so large side values do not need to be squared directly.

Missing-leg calculations use a factored form of c² − b² or c² − a² to reduce cancellation and overflow problems.

Check mode scales all three sides before comparing their squares.

Extremely large results that remain outside JavaScript’s finite numeric range are rejected or marked unavailable.

Historical Context

The right-triangle relationship was known in ancient mathematical traditions before the surviving Greek treatments.

Euclid presented a geometric proof in Book I, Proposition 47 of the Elements.

The familiar name associates the theorem with Pythagoras, but the historical record does not establish that one person was solely responsible for discovering every form of the relationship.

Limits of the Calculator

The equation a² + b² = c² applies only to a right triangle.

A triangle without a 90-degree angle generally requires the law of cosines, law of sines, or additional angle information.

The two-dimensional theorem does not directly calculate a three-dimensional box diagonal unless it is applied in two stages.

Long routes over Earth require geographic or geodesic distance methods rather than a flat-plane triangle.

Structural ramps, roofs, ladders, braces, and surveying work may require tolerances, loading, code compliance, material thickness, sag, terrain, and professional review beyond this calculation.

Privacy and Local Processing

All side parsing, calculation, verification, formatting, and diagram generation run in the browser.

Entered values are not uploaded, added to a public URL, or permanently stored.

Clipboard access is requested only when the primary result is copied.

Pythagorean Theorem and Right-Triangle Formulas

The side formulas follow directly from a² + b² = c². Additional results use the completed right triangle.

Formula variables

First leg adjoining the right angle
Second leg adjoining the right angle
Hypotenuse opposite the right angle
Area
Perimeter
Acute angle opposite a
Acute angle opposite b
Straight-line coordinate distance
Pythagorean theorem
Find the hypotenuse
Find side a
Find side b
Area
Perimeter
Angle opposite a
Angle opposite b
Coordinate distance

Examples

Find the hypotenuse

1

Input

a = 3; b = 4

Show result

Result

c = 5; area = 6; perimeter = 12; acute angles ≈ 36.8699° and 53.1301°.

Find a missing leg

2

Input

b = 12; c = 13

Show result

Result

a = 5 because √(13² − 12²) = √25.

Keep an irrational answer exact

3

Input

a = 1; b = 1

Show result

Result

Exact c = √2; decimal c ≈ 1.4142.

Simplify a radical

4

Input

a = 2; b = 2

Show result

Result

Exact c = 2√2; decimal c ≈ 2.8284.

Verify a right triangle

5

Input

a = 6; b = 8; c = 10

Show result

Result

Yes. 6² + 8² equals 10².

Reject a non-right set

6

Input

a = 5; b = 6; c = 8

Show result

Result

No. The entered legs require c ≈ 7.8102.

Find a rectangle diagonal

7

Input

Width = 9 ft; height = 12 ft

Show result

Result

Diagonal = 15 ft.

Find coordinate distance

8

Input

Horizontal change = 6; vertical change = 8

Show result

Result

Straight-line distance = 10.

Frequently Asked Questions

What is the Pythagorean theorem?

For a right triangle with legs a and b and hypotenuse c, the theorem states a² + b² = c².

How do I find the hypotenuse?

Square the two legs, add the results, and take the positive 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, then take the positive square root.

How do I know which side is c?

Side c is opposite the 90-degree angle and is the longest side of a right triangle.

Can this check whether three sides form a right triangle?

Yes. Enter the longest side as c. The calculator checks the triangle inequality and compares a² + b² with c².

Why must c be longer than either leg?

The hypotenuse lies opposite the largest angle. Algebraically, c² equals the sum of two positive squared legs.

Can I enter decimal side lengths?

Yes. Positive decimals, valid grouped values, and scientific notation are supported.

Can I mix feet and inches?

Not directly. Convert every side to one common unit before entering the values.

Does the unit selector perform conversions?

No. It labels the results only.

Why does the calculator show a radical?

A radical such as √2 is exact, while its decimal representation is rounded.

Why is √8 simplified to 2√2?

Because 8 contains the square factor 4, and √8 = √4 × √2 = 2√2.

What is a Pythagorean triple?

It is a set of positive whole-number sides satisfying the theorem exactly, such as 3–4–5 or 5–12–13.

Does scaling a Pythagorean triple still work?

Yes. Multiplying all three sides by the same positive factor preserves the right angle.

How does the 3–4–5 method square a corner?

Measure 3 units along one edge and 4 along the other. A 5-unit diagonal between the marks forms a right triangle.

How is the distance formula related?

Horizontal and vertical coordinate changes form perpendicular legs, so their straight-line distance is found using the Pythagorean theorem.

Does the theorem work for every triangle?

No. It applies specifically to right triangles. General triangles may require the law of cosines or law of sines.

Can this calculate a box diagonal?

Not directly. A three-dimensional diagonal requires applying the theorem twice or using √(length² + width² + height²).

Is the diagram an exact construction drawing?

No. It reflects the calculated proportions but should not be measured from the screen.

Are my triangle values uploaded?

No. The calculation and diagram are generated locally in the browser.