AI Tools Free

Pythagorean Theorem Calculator

Enter 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.

Free to useNo sign-upRuns in your browser
Enter your details

Enter the inputs, then select Calculate result.

Your result
Enter your details

Result will appear here

How the Pythagorean Theorem Formula Calculator Works

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.

Right triangle diagram illustrating the Pythagorean theorem formula a^2 + b^2 = c^2
Right triangle diagram showing perpendicular legs a and b meeting at a 90-degree angle and hypotenuse c = sqrt(a^2 + b^2) opposite the right angle.

Pythagorean Triples & Right Triangle Quick Reference Table

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 / ApplicationFirst Leg aSecond Leg bSum 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)349 + 16 = 255Smallest primitive integer right triangle
Carpentry Framing Layout (2x)6836 + 64 = 10010Standard 6-8-10 ft deck and wall squaring check
Foundation Corner Layout (3x)91281 + 144 = 225159-12-15 ft layout for large slab corners
5-12-13 Primitive Triple51225 + 144 = 16913Common 5:12 roof pitch rafter length per 12 ft run
8-15-17 Primitive Triple81564 + 225 = 28917Integer right triangle used in trigonometry benchmarks
7-24-25 Primitive Triple72449 + 576 = 62525High-aspect-ratio integer ramp and truss triangle
20-21-29 Primitive Triple2021400 + 441 = 84129Nearly isosceles integer right triangle (a approx b)
9-40-41 Primitive Triple94081 + 1600 = 168141Long-span surveyor right-angle baseline
Isosceles 45-45-90 Square111 + 1 = 21.41421356237 (sqrt(2))Unit square diagonal; multiply leg by sqrt(2)
Half-Equilateral 30-60-9011.73205080757 (sqrt(3))1 + 3 = 42Short leg 1, long leg sqrt(3), hypotenuse 2

Step-by-Step Guide to Using the Pythagorean Theorem Calculator

Follow these three steps to enter your two perpendicular legs, keep length units consistent, and export the hypotenuse.

Enter the First Perpendicular Leg

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.

Input and settings
Step 1 entering First perpendicular leg 3 in the Pythagorean Theorem Calculator
First perpendicular leg input field set to 3 inside the calculator workspace.

Enter the Second Perpendicular Leg

Populate Second perpendicular leg (#b, preloaded with 4) using the exact same linear measurement unit (ft, in, m, or cm) as the first leg.

Tool result
Step 2 entering Second perpendicular leg 4 in the Pythagorean Theorem Calculator
Second perpendicular leg input field set to 4 using the same length unit.

Calculate and Copy the Hypotenuse

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.

Review the details
Step 3 viewing calculated hypotenuse 5 in the result panel
Output panel displaying hypotenuse result 5 with Copy and Download buttons.

Practical Worked Examples to Calculate Pythagorean Theorem

These three real-world scenarios show how to calculate Pythagorean theorem hypotenuse lengths for carpentry layout, roof rafters, and square mitre diagonals.

Carpentry 3-4-5 Wall Corner Check: a = 3 ft, b = 4 ft

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.

Worked example 1 showing a 3-4-5 carpentry corner layout with hypotenuse 5 ft
Carpentry 3-4-5 triangle layout checking a 90-degree wall corner.

Roof Rafter Common Run & Rise: a = 12 ft, b = 5 ft

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.

Worked example 2 showing a 5:12 roof pitch rafter with 12 ft run, 5 ft rise, and 13 ft length
Roof framing cross-section with 12 ft horizontal run, 5 ft vertical rise, and 13 ft rafter hypotenuse.

Square Tile Diagonal Cut: a = 12 in, b = 12 in

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.

Worked example 3 showing a 12x12 inch square tile with diagonal 16.9705627485 inches
12 by 12 inch square tile showing diagonal hypotenuse length 16.9705627485 inches.

How to Read and Verify the Pythagorean Theorem Output

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.

Diagram showing that the hypotenuse c is always between max(a, b) and a + b
Right triangle diagram illustrating the geometric inequality max(a, b) < c < a + b.

Scope Limits, Unit Rules & Related Pythagorean Theorem Calculators

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.

Related right-triangle and coordinate distance calculators connected to the Pythagorean Theorem Calculator
Workflow diagram connecting the Pythagorean Theorem Calculator to Right Triangle Trigonometry, Triangle Side, Rectangle Diagonal, and 3D Vector Magnitude calculators.

Frequently Asked Questions About Pythagorean Theorem Calculator

Answers about using Pythagorean Theorem Calculator and understanding its results.

What is the Pythagorean theorem formula to find the hypotenuse c?

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.

How do you find a missing leg (a or b) when you already know the hypotenuse c?

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.

What are the most common Pythagorean triples used in construction and geometry?

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.

How do you enter feet and inches into the Pythagorean theorem calculator?

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).

Does the Pythagorean theorem work on non-right triangles?

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.

Calculate result with your input

Choose another tool for your next calculation, conversion, or text task.

Calculate result