Last updated: July 16, 2026
Pythagorean Theorem Calculator
Creators
Dharmendra SinghReviewers

Creators
Dharmendra SinghReviewers
Quick Answer
The Pythagorean theorem calculator finds any missing side of a right triangle using a² + b² = c². Enter two of the three sides (legs a, b or hypotenuse c) in any of nine length units (mm, cm, m, km, in, ft, yd, mi, nmi) and leave the third empty — the calculator auto-detects which side to solve for: hypotenuse c = √(a² + b²), leg a = √(c² − b²), or leg b = √(c² − a²). Mixed units are supported; all conversions are handled internally. The calculator also returns triangle area (½ × a × b) and perimeter (a + b + c), both in the missing side's unit. The theorem was known to Babylonian mathematicians c. 1800 BC and has over 370 known proofs.
To use the Pythagorean theorem calculator, enter any two sides of a right triangle and leave the third field empty — the tool finds the hypotenuse using c equals the square root of a squared plus b squared, or a missing leg using a equals the square root of c squared minus b squared, automatically in your chosen length unit.
Key Takeaways
- The Pythagorean theorem (a² + b² = c²) applies only to right triangles — those with exactly one 90° angle.
- The hypotenuse c is always the longest side, opposite the right angle; legs a and b are the shorter sides.
- Any Pythagorean triple (like 3-4-5 or 5-12-13) satisfies the theorem with integer values.
- The theorem extends to 3D as d = √(a² + b² + c²) for the space diagonal of a rectangular box.
- Over 370 independent proofs of the Pythagorean theorem exist, more than any other mathematical theorem.
Creators
Dharmendra SinghReviewers

Creators
Dharmendra SinghReviewers
Formula
a² + b² = c²
Where:
- a=Leg a(length unit)
- b=Leg b(length unit)
- c=Hypotenuse(length unit)
Worked Examples
Classic 3-4-5 Right Triangle
Find the hypotenuse of a right triangle with legs a = 3 and b = 4.
- 1Write the Pythagorean theorem: c² = a² + b²
- 2Substitute values: c² = 3² + 4² = 9 + 16 = 25
- 3Take the square root: c = √25 = 5
- 4Area = ½ × 3 × 4 = 6 square units
- 5Perimeter = 3 + 4 + 5 = 12 units
Find a Missing Leg (Leg a)
Find leg a when hypotenuse c = 13 and leg b = 12.
- 1Rearrange: a² = c² − b²
- 2Substitute: a² = 13² − 12² = 169 − 144 = 25
- 3Take the square root: a = √25 = 5
- 4Area = ½ × 5 × 12 = 30 square units
- 5Perimeter = 5 + 12 + 13 = 30 units
Real-World: Diagonal of a Rectangle
A rectangle is 6 m wide and 8 m tall. Find the diagonal (hypotenuse).
- 1Model the diagonal as the hypotenuse: c² = a² + b²
- 2Substitute: c² = 6² + 8² = 36 + 64 = 100
- 3Take the square root: c = √100 = 10 m
- 4Area of triangle = ½ × 6 × 8 = 24 m²
- 5Perimeter of triangle = 6 + 8 + 10 = 24 m
Introduction
The Pythagorean theorem (a² + b² = c²) is the most fundamental relationship in plane geometry. It states that in any right triangle, the square of the hypotenuse — the side opposite the 90° angle — equals the sum of the squares of the two shorter sides (called legs). This free online Pythagorean theorem calculator finds any missing side when two sides are known and automatically computes the triangle's area (½ × a × b) and perimeter (a + b + c). Enter values in any of the nine supported length units — millimeters, centimeters, meters, kilometers, inches, feet, yards, miles, or nautical miles — and mix units freely; the calculator converts internally and returns the result in the unit you chose for the missing side. Leave one field empty and the tool auto-detects which side to solve for: hypotenuse c = √(a² + b²), leg a = √(c² − b²), or leg b = √(c² − a²).
The Pythagorean Theorem Explained
For a right triangle with legs a and b and hypotenuse c, the Pythagorean theorem states: a² + b² = c². The hypotenuse is always the longest side and lies opposite the 90° right angle. The equation encodes a deep geometric truth: the square drawn on the hypotenuse has the same area as the two squares drawn on the legs combined. This is why the formula works — you can cut and rearrange the area of those two smaller squares to fill the larger one exactly. The theorem is not just about integers. It holds for any positive real numbers: a triangle with legs 1 and 1 gives hypotenuse √2 ≈ 1.4142, an irrational number. That discovery by the ancient Greeks — that √2 is irrational — was philosophically revolutionary and historically attributed to the Pythagoreans. The theorem was independently known to Babylonian mathematicians (c. 1800 BC), Indian scholars in the *Sulba Sutras* (~800 BC), and Chinese mathematicians in the *Zhoubi Suanjing* (~1000 BC), all long before Pythagoras. The first documented general proof is attributed to the Greek mathematical tradition around 570–495 BC. You can verify results with the special right triangles calculator.
How to Use This Calculator
Enter any two known sides and leave the unknown side field empty — the calculator automatically detects which side to solve for: - Find hypotenuse c: enter leg a and leg b, leave c empty. - Find leg a (Base): enter leg b and hypotenuse c, leave a empty. - Find leg b (Perpendicular): enter leg a and hypotenuse c, leave b empty. Each field has its own unit selector (mm, cm, m, km, in, ft, yd, mi, nmi). You can mix units freely — for example, enter leg a in feet and leg b in meters. The calculator normalizes all values to meters internally, solves the theorem, then converts the result back to the unit you selected for the missing side. Key constraint: the hypotenuse must always be longer than either leg. If you enter values that violate this (for example, hypotenuse = 3 m and leg = 5 m), the calculator shows a clear error message. For area and perimeter of non-right triangles, see the triangle area calculator for Heron's formula.
- Find c (hypotenuse):
c = √(a² + b²) — enter a and b
- Find a (base):
a = √(c² − b²) — enter b and c, hypotenuse must be > b
- Find b (perpendicular):
b = √(c² − a²) — enter a and c, hypotenuse must be > a
- Triangle area:
Area = ½ × a × b (legs only — not hypotenuse)
- Perimeter:
P = a + b + c (all three sides summed)
Proof and History
The Pythagorean theorem has over 370 known proofs — more than any other theorem in mathematics (Elisha Scott Loomis catalogued 370 by 1940). Here are the most important: Euclid's proof (*Elements*, Book I, Proposition 47, ~300 BC) uses geometric area arguments — two rectangles within a large square are shown equal to the two leg-squares. Algebraic rearrangement proof: arrange four congruent right triangles inside a large square. The inner quadrilateral is also a square (the hypotenuse square). Equating areas gives a² + b² = c². Garfield's proof (1876): U.S. President James A. Garfield independently discovered a proof using a trapezoid whose area yields the theorem. Published in the *New England Journal of Education*. The theorem appears in Babylonian clay tablet Plimpton 322 (c. 1800 BC), which lists 15 Pythagorean triples with impressive precision. The Zhoubi Suanjing (~1000 BC) gives a visual proof using colored squares. More complete history at MathWorld and Britannica.
Tip: Garfield's proof (1876) requires only the area formula for a trapezoid — an elegant one-page proof that any student can verify independently.
Pythagorean Triples Reference Table
A Pythagorean triple is a set of three positive integers (a, b, c) satisfying a² + b² = c². Triples with no common factor are called primitive. Every primitive triple can be generated by choosing integers m > n > 0 with opposite parity and gcd(m, n) = 1: a = m² − n², b = 2mn, c = m² + n². Scaling any triple by an integer k gives another valid triple. For example, 2 × (3, 4, 5) = (6, 8, 10). There are infinitely many Pythagorean triples — one for every valid (m, n) pair. Use these to verify your calculator with exact integer inputs:
| a (Base) | b (Perpendicular) | c (Hypotenuse) | Type | Scale of |
|---|---|---|---|---|
| 3 | 4 | 5 | Primitive | — |
| 5 | 12 | 13 | Primitive | — |
| 8 | 15 | 17 | Primitive | — |
| 7 | 24 | 25 | Primitive | — |
| 20 | 21 | 29 | Primitive | — |
| 9 | 40 | 41 | Primitive | — |
| 6 | 8 | 10 | Derived | 2 × (3,4,5) |
| 9 | 12 | 15 | Derived | 3 × (3,4,5) |
| 10 | 24 | 26 | Derived | 2 × (5,12,13) |
Length Unit Conversion Reference
This calculator accepts any of nine length units per input. Conversions to meters (the internal base unit):
| Unit | Symbol | Meters Equivalent | Common Use |
|---|---|---|---|
| Millimeter | mm | 0.001 m | Engineering, manufacturing |
| Centimeter | cm | 0.01 m | Everyday measurement, science |
| Meter | m | 1.000 m | Architecture, construction |
| Kilometer | km | 1000 m | Geography, road distances |
| Inch | in | 0.0254 m | US construction, screens |
| Foot | ft | 0.3048 m | US building, aviation altitude |
| Yard | yd | 0.9144 m | US/UK sports, fabric |
| Mile | mi | 1609.344 m | US/UK road distances |
| Nautical mile | nmi | 1852 m | Maritime, aviation navigation |
Note: All cross-unit calculations are handled internally. Enter each side in whatever unit is most natural for your problem — the calculator converts before solving and returns the result in the missing side's unit.
Practical Real-World Applications
The Pythagorean theorem is one of the most applied theorems in all of STEM: Architecture and construction: The 3-4-5 rule checks that corners are exactly 90°. Builders measure 3 ft along one wall and 4 ft along the adjacent wall — if the diagonal is exactly 5 ft, the corner is square. This trick works on any scale (6-8-10, 9-12-15, etc.). Navigation and GPS: Horizontal distance between two GPS coordinates is computed with the Pythagorean theorem (extended to spherical or WGS84 for long distances). Aviation uses it for straight-line distances between waypoints. Computer graphics and game development: The Euclidean distance between two screen pixels (x₁,y₁) and (x₂,y₂) is √((x₂−x₁)² + (y₂−y₁)²) — the Pythagorean theorem in disguise. Collision detection, raycasting, and pathfinding all rely on it. Physics and engineering: Resultant forces, velocity vectors, electromagnetic field components, and structural diagonal bracing all use the theorem. The impedance triangle in AC circuits (R, X, Z) satisfies Z² = R² + X². For non-right triangles, see the law of cosines calculator (c² = a² + b² − 2ab·cos C) and the law of sines calculator.
Extension to 3D Space and Higher Dimensions
The theorem extends naturally beyond 2D: 3D space diagonal: The main diagonal of a rectangular box with dimensions a × b × c is d = √(a² + b² + c²). This is the Pythagorean theorem applied twice — first to the base face (a, b), then to the vertical leg (c). n-dimensional Euclidean distance: In any n-dimensional Euclidean space, the distance between points P = (p₁, …, pₙ) and Q = (q₁, …, qₙ) is √(Σᵢ(pᵢ − qᵢ)²). This is the generalized Pythagorean theorem and is fundamental to machine learning (k-nearest neighbors, support vector machines) and signal processing. Relativity: In special relativity, the spacetime interval s² = c²t² − x² − y² − z² is a pseudo-Pythagorean formula with opposite signs — replacing the flat Euclidean metric with the Minkowski metric. More detail on generalizations at Wikipedia — Generalizations of the Pythagorean theorem and NIST Digital Library of Mathematical Functions.
Tip: For a quick check — the diagonal of a 1×1×1 cube is √3 ≈ 1.732 m. This is a common interview question in software engineering.
Right Triangle Area and Perimeter
Once all three sides are known, this calculator also computes: Area = ½ × a × b — the area of a right triangle uses only the two legs (not the hypotenuse), because the right angle makes the legs the base and height. Example: legs 3 m and 4 m → Area = ½ × 3 × 4 = 6 m². Perimeter = a + b + c — the sum of all three sides. Example: 3 m + 4 m + 5 m = 12 m. Units for both outputs match the unit selected for the calculated (missing) side. Cross-unit note: When inputs use mixed units, the area is computed after normalizing everything to meters, then converted back to the result unit squared. For example, a = 300 cm + b = 4 m → internal: a = 3 m, b = 4 m → area = 6 m². For more area formulas (Heron's formula for any triangle, base × height / 2 for general triangles), see the triangle area calculator. For the perimeter of polygons, see the perimeter calculator.
Area = ½ × leg_a × leg_b (legs only, not hypotenuse)
Perimeter = leg_a + leg_b + hypotenuse
Both outputs use the same unit as the calculated missing side
Area unit is the length unit squared (cm², m², ft², etc.)
Limitations and When NOT to Use This Calculator
Non-right triangles: The Pythagorean theorem strictly requires one 90° angle. If your triangle has angles other than 90°, use the law of cosines calculator: c² = a² + b² − 2ab·cos(C). For angle calculations from known sides, use the law of sines calculator. Curved surfaces: On the surface of a sphere (Earth, globe), the Pythagorean theorem is only an approximation for very short distances. For geodesic distances, use the haversine formula or the spherical law of cosines. GPS navigation uses the WGS84 ellipsoid model, not flat Euclidean geometry. Floating-point precision: For irrational results like √2 or √3, the calculator rounds to 4 decimal places. This introduces a tiny rounding error — do not expect perfect integer round-trips for irrational hypotenuses. Physical impossibility: If the computed value is negative inside the square root (which would mean the hypotenuse is shorter than a leg), the calculator catches this and shows a clear error message rather than returning a non-real result.
Note: If you get an error saying 'Hypotenuse must be greater than…', check your inputs. In a right triangle, the hypotenuse is always strictly greater than either leg — this is a mathematical constraint, not a calculator limitation.
Quick Reference Card
Pythagorean Theorem Quick Reference
Quick reference • Pythagorean Theorem Calculator
a² + b² = c²Valid range: All positive real numbers where c > a and c > b (for real solutions)
Common Values
⚠ Watch Out
- •Only works for right triangles (one 90° angle). Use the Law of Cosines for other triangles.
- •The hypotenuse must always be greater than either leg; otherwise the inputs are invalid.
- •Ensure consistent units — mixing meters and centimeters will produce wrong answers.
- •Floating-point rounding may cause tiny errors for irrational results like √2 or √3.
Pro Tips
- →Verify inputs form a valid right triangle: the result c must satisfy c > a and c > b.
- →Use integer Pythagorean triples (3-4-5, 5-12-13) to double-check your calculator with exact values.
- →For non-right triangles, use the Law of Cosines: c² = a² + b² − 2ab·cos(C).
- →Scale any triple by a constant to get a new valid triple — e.g., 2×(3-4-5) = (6-8-10).
FAQs
What is the Pythagorean theorem?
The Pythagorean theorem states that in any right triangle, the square of the hypotenuse (c) equals the sum of the squares of the two legs (a and b): a² + b² = c². It applies exclusively to right triangles — those with exactly one 90° interior angle. The theorem has been independently discovered in at least four ancient civilizations and has over 370 known proofs.
How do I find the hypotenuse?
Enter the lengths of both legs (a and b) and leave the hypotenuse field empty. The calculator computes c = √(a² + b²). For example, with a = 3 m and b = 4 m, c = √(9 + 16) = √25 = 5 m. The result appears in the unit you selected for side c.
How do I find a missing leg?
Enter the hypotenuse and the known leg, and leave the unknown leg field empty. For leg a: a = √(c² − b²). For leg b: b = √(c² − a²). The hypotenuse must always be longer than either leg — if it is not, the calculator displays an error explaining which values are invalid.
Can I enter values in different units for each side?
Yes. Each input field has its own unit selector (mm, cm, m, km, in, ft, yd, mi, nmi). You can enter leg a in feet and leg b in centimeters, for example. The calculator converts all values to meters internally, solves the theorem, then returns the result in the unit selected for the missing side.
Why am I getting an error about the hypotenuse?
In a right triangle, the hypotenuse is always strictly greater than either leg. If you enter a hypotenuse value smaller than or equal to one of the legs, there is no real solution — the square root would require a negative number under it. The calculator detects this and shows an error such as 'Hypotenuse (3 m) must be greater than Base (5 m)'.
What are Pythagorean triples?
Pythagorean triples are sets of three positive integers (a, b, c) satisfying a² + b² = c². The simplest is (3, 4, 5). Other common ones include (5, 12, 13), (8, 15, 17), (7, 24, 25), and (20, 21, 29). Scaling any triple by a positive integer gives another valid triple — (6, 8, 10) is 2 × (3, 4, 5). There are infinitely many primitive Pythagorean triples.
Does the Pythagorean theorem work in 3D?
Yes — the space diagonal of a rectangular box with dimensions a, b, c is d = √(a² + b² + c²). This is the Pythagorean theorem applied twice. In general n-dimensional Euclidean space, the Euclidean distance between two points is the square root of the sum of squared coordinate differences, which is the direct generalization.
Why must the hypotenuse be longer than the legs?
Because c² = a² + b², we have c² > a² and c² > b² (since both a² and b² are positive), which means c > a and c > b always. If a leg were longer than the hypotenuse, the formula would require √(negative number), which has no real solution.
How is triangle area calculated here?
The area of a right triangle is Area = ½ × leg_a × leg_b. The two legs serve as the base and height of the triangle (since the right angle makes them perpendicular). The hypotenuse is not used in the area formula. The result is displayed in the missing side's unit squared (e.g., cm², m², ft²).
Does this work for non-right triangles?
No — the Pythagorean theorem applies only to right triangles with a 90° angle. For triangles with other angle combinations, use the law of cosines (c² = a² + b² − 2ab·cos C) or the law of sines. Heron's formula can compute the area of any triangle from its three side lengths.