
Right Triangle Trigonometry Calculator
Solve right-triangle sides, acute angles and their sine, cosine and tangent.
Open toolEnter First perpendicular leg (a) and Second perpendicular leg (b) into this Pythagorean theorem calculator to compute the hypotenuse length c = sqrt(a^2 + b^2) of any right-angled triangle in your browser. Test the preloaded 3-4-5 baseline, solve roof-rafter and framing diagonals, or evaluate positive leg lengths from 10^-9 to 1,000,000,000 with 12-significant-digit precision.
Enter the inputs, then select Calculate result.
Result will appear here
In any planar right triangle, the two shorter sides a and b that meet at the 90-degree right angle are called the perpendicular legs (or catheti), and the longest side c opposite the right angle is the hypotenuse. The Pythagorean theorem states that the area of the square built on the hypotenuse equals the sum of the areas of the squares built on the two legs (a^2 + b^2 = c^2). Taking the positive square root of both sides gives the direct formula used by this Pythagorean theorem formula calculator. If you already know the hypotenuse c and one leg a, rearrange the same identity to solve for the missing leg: b = sqrt(c^2 - a^2).
c = sqrt(a^2 + b^2) | Missing leg: b = sqrt(c^2 - a^2)
In client-side JavaScript (batch10-tools.js), the workspace evaluates Math.hypot(n('a'), n('b')) rather than naive Math.sqrt(a*a + b*b). By factoring out the larger leg before squaring, Math.hypot prevents IEEE 754 floating-point overflow when leg dimensions approach 10^9 and displays the resulting length up to 12 significant digits.
Use this reference table of primitive Pythagorean triples, scaled framing layouts, and special right triangles (45-45-90 and 30-60-90) to verify your inputs in the Pythagoras theorem calculator.
| Triangle Type / Application | First Leg a | Second Leg b | Sum of Squares (a^2 + b^2 = c^2) | Exact Hypotenuse c = sqrt(a^2 + b^2) | Geometry / Construction Note |
|---|---|---|---|---|---|
| Classic 3-4-5 Triple (Preloaded) | 3 | 4 | 9 + 16 = 25 | 5 | Smallest primitive integer right triangle |
| Carpentry Framing Layout (2x) | 6 | 8 | 36 + 64 = 100 | 10 | Standard 6-8-10 ft deck and wall squaring check |
| Foundation Corner Layout (3x) | 9 | 12 | 81 + 144 = 225 | 15 | 9-12-15 ft layout for large slab corners |
| 5-12-13 Primitive Triple | 5 | 12 | 25 + 144 = 169 | 13 | Common 5:12 roof pitch rafter length per 12 ft run |
| 8-15-17 Primitive Triple | 8 | 15 | 64 + 225 = 289 | 17 | Integer right triangle used in trigonometry benchmarks |
| 7-24-25 Primitive Triple | 7 | 24 | 49 + 576 = 625 | 25 | High-aspect-ratio integer ramp and truss triangle |
| 20-21-29 Primitive Triple | 20 | 21 | 400 + 441 = 841 | 29 | Nearly isosceles integer right triangle (a approx b) |
| 9-40-41 Primitive Triple | 9 | 40 | 81 + 1600 = 1681 | 41 | Long-span surveyor right-angle baseline |
| Isosceles 45-45-90 Square | 1 | 1 | 1 + 1 = 2 | 1.41421356237 (sqrt(2)) | Unit square diagonal; multiply leg by sqrt(2) |
| Half-Equilateral 30-60-90 | 1 | 1.73205080757 (sqrt(3)) | 1 + 3 = 4 | 2 | Short leg 1, long leg sqrt(3), hypotenuse 2 |
Follow these three steps to enter your two perpendicular legs, keep length units consistent, and export the hypotenuse.
Type the length of your first 90-degree side into First perpendicular leg (#a, preloaded with 3). Accepts any positive number from 1e-09 to 1000000000.0.
Populate Second perpendicular leg (#b, preloaded with 4) using the exact same linear measurement unit (ft, in, m, or cm) as the first leg.
Click Calculate result to compute the hypotenuse length c. Use Copy or Download to save the value for framing plans, CAD drawings, or geometry homework.
These three real-world scenarios show how to calculate Pythagorean theorem hypotenuse lengths for carpentry layout, roof rafters, and square mitre diagonals.
To verify that two framed walls meet at an exact 90-degree corner, a carpenter marks 3 feet along the first wall (First perpendicular leg = 3) and 4 feet along the second wall (Second perpendicular leg = 4). Evaluating sqrt(3^2 + 4^2) = sqrt(9 + 16) = sqrt(25) returns 5 feet. When a tape measure pulled between the two marks reads exactly 5 ft, the corner is square.

A gable roof has a horizontal half-span (run) of 12 feet and a vertical ridge rise of 5 feet (5:12 pitch). Entering 12 and 5 into the calculator produces sqrt(12^2 + 5^2) = sqrt(144 + 25) = sqrt(169) = 13. The theoretical line length of the common rafter from outer wall plate to ridge center is 13 feet.

A tile setter cuts a 12 in x 12 in porcelain tile corner-to-corner along its 45-degree diagonal. Entering 12 for both perpendicular legs yields sqrt(12^2 + 12^2) = sqrt(288) = 16.9705627485 inches (just under 16 31/32 in), giving the exact wet-saw travel required for the diagonal cut.

The number displayed in the result panel is the linear length of the hypotenuse c expressed in the exact same unit as your two input legs. If you enter both legs in inches, the output is in linear inches; if you enter both legs in meters, the output is in linear meters (never squared or cubed units).
Strictly longer than either leg (c > max(a, b)): Because the hypotenuse sits opposite the 90-degree angle (the largest angle in a right triangle), c must always exceed the longer of the two legs.
Strictly shorter than the sum of the legs (c < a + b): By the triangle inequality, walking straight along the diagonal hypotenuse is always shorter than walking along leg a and then leg b. For a = 3 and b = 4, the hypotenuse 5 sits strictly between max(3, 4) = 4 and 3 + 4 = 7.

Verify these three operational constraints before relying on the calculated length:
Perpendicular legs and single-unit input: First perpendicular leg and Second perpendicular leg represent the two sides that form the 90-degree corner. Convert compound feet-and-inches measurements to a single unit (total inches or decimal feet) before entering, and remember that c = sqrt(a^2 + b^2) holds only when the included angle is exactly 90 degrees.
Solve acute angles and trig ratios in the Right Triangle Trigonometry Calculator, find non-right triangle sides with the Law of Cosines in the Triangle Side Calculator, check corner-to-corner diagonals in the Rectangle Diagonal Calculator, compute area and perimeter in the Triangle Area Calculator and Triangle Perimeter Calculator, or find 2D/3D coordinate distances in the Distance Between Two Points Calculator and Vector Magnitude Calculator.


Solve right-triangle sides, acute angles and their sine, cosine and tangent.
Open tool
Find the opposite side with the cosine rule.
Open tool
Use this rectangle diagonal calculator and diagonal of a rectangle calculator to find corner-to-corner length d = √(width² + height²) for geometry and framing.
Open toolChoose another tool for your next calculation, conversion, or text task.

Use our free distance between two points calculator to find the 2D Euclidean distance between (x1, y1) and (x2, y2) with step-by-step distance formula rules.
Open tool
Calculate the Euclidean length of any 2D or 3D vector with our free vector magnitude calculator. Enter X, Y, and Z components for instant, exact results.
Open tool
Use our free triangle area calculator and area of a triangle calculator to compute A = (b * h) / 2 from base and perpendicular height in your browser.
Open tool
Our triangle perimeter calculator computes P = a + b + c and semiperimeter s = P/2 from three side lengths with strict triangle inequality validation.
Open toolAnswers about using Pythagorean Theorem Calculator and understanding its results.
For any right-angled triangle with perpendicular legs a and b and hypotenuse c opposite the 90-degree angle, the Pythagorean theorem states a^2 + b^2 = c^2. Solving for the hypotenuse gives c = sqrt(a^2 + b^2): square each leg, add the two squares together, and take the positive square root.
If you know the hypotenuse c and one perpendicular leg a, subtract a^2 from c^2 before taking the square root: b = sqrt(c^2 - a^2) (or a = sqrt(c^2 - b^2)). For example, if a right triangle has hypotenuse c = 13 and leg a = 5, the missing leg is sqrt(13^2 - 5^2) = sqrt(169 - 25) = sqrt(144) = 12.
A Pythagorean triple is a set of three positive integers (a, b, c) that satisfy a^2 + b^2 = c^2 exactly without decimals. The most widely used primitive triples are (3, 4, 5), (5, 12, 13), (8, 15, 17), (7, 24, 25), and (20, 21, 29), along with scaled multiples such as (6, 8, 10) and (9, 12, 15) for squaring building layouts.
Convert compound feet-and-inches measurements into a single unit before typing them into the form. Either multiply feet by 12 and add the remaining inches to work in total inches (then divide the output by 12 to return to feet), or divide the inches by 12 to enter decimal feet (such as 3.25 for 3 ft 3 in and 4.5 for 4 ft 6 in).
No. The formula a^2 + b^2 = c^2 applies exclusively to right triangles that contain a 90-degree angle between legs a and b. For acute or obtuse triangles where the angle gamma between sides a and b is not 90 degrees, you must include the cosine correction term from the Law of Cosines (c = sqrt(a^2 + b^2 - 2ab cos(gamma))) using our Triangle Side Calculator.
Choose another tool for your next calculation, conversion, or text task.