How to use
Find diagonals, square layouts, and calculate rise & run with feet, inches, fractions or metric measurements.
Choose Triangle, Square It Up or Rise & Run. In Triangle or Rise & Run, enter exactly two sides and leave the missing side blank. Square It Up takes width and length. Choose each input unit separately; a written unit or quote notation overrides its selector. Results update as you type. The default triangle is 12 ft by 9 ft, giving a 15 ft diagonal.
Choose nearest 1/8, 1/16 (default) or 1/32 inch, and a result display unit. Copy the primary measurement or all triangle results. Open Show calculation for the algebra. Recent calculations keep up to 10 valid entries in page memory; restore, remove or clear them. Refresh and Reset clear history. Reset also restores all mode defaults.
Pythagorean theorem formula
The Pythagorean theorem is a² + b² = c² for a right triangle.
- a
- One perpendicular leg, or horizontal run.
- b
- The other perpendicular leg, or vertical rise.
- c
- The hypotenuse: the diagonal opposite the right angle, longer than either leg.
Squaring a length produces an area in squared units. Add the two leg squares, then take the positive square root to recover the diagonal length.
Solving any missing side
- Missing diagonal: c = √(a² + b²).
- Missing side A: a = √(c² − b²).
- Missing side B: b = √(c² − a²).
For example, c = 15 ft and b = 9 ft give a = √(225 − 81) = 12 ft. A known hypotenuse must exceed the known leg. Equal or shorter values cannot produce a positive missing leg. All three populated fields or more than one blank field are rejected; this interface solves one missing side.
Construction measurements
Enter feet/inches such as 8′ 7 3/8″, whole or fractional inches such as 103 3/8″, decimal inches such as 103.375 in, decimal feet such as 8.6146 ft, or metric values such as 2625 mm and 2.625 m. A bare number uses its selector; bare ft/in values mean inches. A fraction denominator must be positive and at most 4096. Use one written unit or quote notation, rather than combining both.
Internally, lengths are exact reduced fractions of an inch. One foot is 12 inches, and one inch is exactly 25.4 millimeters. Decimal input and metric conversion remain rational through squared-length arithmetic. Square roots that are not rational have a separate decimal approximation. Exact radicals are simplified where practical with a bounded factor search; very large radicals may remain partially simplified.
Construction display rounds to the nearest selected fraction using half-up rounding, including exact halfway values. Carry is handled across whole inches and feet: 11 31/32″ rounds to 1′ 0″ at nearest 1/16″. The engine compares squared values exactly, even for irrational diagonals. Decimal feet, inches and meters describe the underlying calculated length, rather than the fraction-rounded length. Decimal outputs normally use up to four decimal places, with scientific notation for very small values. Display precision does not improve measurement accuracy.
Square It Up
Enter the intended width and length to find the required corner-to-corner diagonal. For 12 ft × 16 ft, the required diagonal is 20 ft.
Measure both corner-to-corner diagonals. Equal diagonals are a practical squareness check for a rectangular layout when opposite sides are intended to match. Confirm opposite-side measurements and compare both diagonals with the calculated target. Matching diagonals alone do not establish that an arbitrary quadrilateral is a rectangle.
If the diagonals match, the rectangular layout is square within your measuring tolerance. If they differ, adjust the layout until both diagonals match as closely as your project requires. No project-specific construction tolerance is supplied. The optional comparison reports their absolute difference and identifies the longer diagonal; it does not certify the layout.
After checking the dimensions, estimate a budget for a measured deck rectangle using your own prices and allowances. Neither the geometric check nor the budget estimate certifies structural safety or supplies building-code or permit approval.
3-4-5 method
The 3-4-5 method uses 3² + 4² = 5². Measure 3 units along one leg and 4 along the other; a 5-unit diagonal establishes a right angle in the ideal geometry. All three distances must use the same unit. Larger proportional triangles use the same ratio.
Quick Layout presets load 3–4–5, 6–8–10, 9–12–15 or 12–16–20 in feet. To scale your own, enter the available short leg, long leg or diagonal. Divide that measurement by 3, 4 or 5, then multiply by each ratio number. For an 8 ft long leg, the short leg is 6 ft and diagonal 10 ft. For an 8 ft short leg, the scale is 8/3 ft per ratio unit, the long leg is 10⅔ ft and diagonal 13⅓ ft. The selected construction precision controls the practical fraction display.
Rise and run
Rise is vertical change, run is horizontal change, and slope length is their diagonal distance. This mode maps a = run, b = rise and c = slope length. Enter any two positive values and leave one blank.
Slope length = √(rise² + run²). Angle from horizontal = atan2(rise, run). Percent grade = rise / run × 100%. Rise : run is simplified when both sides are exact rational lengths. A rise of 3 ft over a run of 12 ft gives 25% grade and ratio 1 : 4. This is general slope terminology; the ratio is not automatically labeled roof pitch.
For supported roof geometry, calculate a common rafter from span and pitch separately. Roof-specific span and pitch conventions must be checked; a slope length does not determine structural adequacy or installation approval.
For stair-specific geometry, calculate a separate stair rise-and-tread layout with explicit stair assumptions. A right-triangle diagonal alone is not a complete stringer layout, material specification or code-compliance check.
Angles
The acute angle θ₁ opposite B is atan2(b, a), converted from radians to degrees. The other acute angle θ₂ is 90° − θ₁. They add to 90° apart from numeric display rounding. A 12–9–15 triangle has angles approximately 36.86989765° and 53.13010235°, displayed as 36.87° and 53.13°. Rise & Run uses θ₁ as the angle from horizontal. Angles are secondary to the missing measurement.
Worked examples
Find a triangle diagonal
A = 12 ft, B = 9 ft. c = √(12² + 9²) = √(144 + 81) = √225 = 15 ft. The acute angles are approximately 36.87° and 53.13°.
Square a rectangular layout
Width = 12 ft, length = 16 ft. c = √(12² + 16²) = √400 = 20 ft. Compare both corner-to-corner diagonals and confirm matching opposite sides for the intended rectangle.
Use construction fractions
A = 8′ 7 3/8″ = 103.375 in; B = 6′ 2 1/2″ = 74.5 in. The exact diagonal is √1039145 / 8 inches, approximately 127.4231 in. At nearest 1/16″ it displays 10′ 7 7/16″. The underlying length is approximately 10.6186 ft or 3.2365 m. This fixture is calculated by the engine and locked by tests; its decimal values describe the unrounded diagonal.
Calculate rise and run
Rise = 3 ft, run = 12 ft. Slope length = √(3² + 12²) = √153 = 3√17 ft ≈ 12.3693 ft. The angle from horizontal is approximately 14.04°, percent grade is 25%, and rise : run is 1 : 4. At nearest 1/16″ the slope displays 12′ 4 7/16″.
Retain an exact radical
A = 5 ft and B = 5 ft give c = √50 = 5√2 ft ≈ 7.0711 ft. A fraction-rounded construction measurement is practical; the exact radical retains the mathematical value.
Assumptions and limitations
The Pythagorean theorem applies to right triangles, where the two legs are perpendicular. This tool assumes a right angle and cannot infer an arbitrary triangle from two sides. The SVG is illustrative and not to scale.
Field measurements may differ because of measuring tolerance, material movement, uneven surfaces, layout error, rounding and tool accuracy. Verify the actual layout and the precision required for your work. This calculator provides no structural engineering approval, load-bearing assessment or code-compliance determination.
Each input is bounded to 128 characters, 16 tokens and 18 digits per numeric literal; fraction denominators are at most 4096. Known and calculated lengths must be between 10⁻⁹ and 10⁷ inches after conversion. These are implementation safety bounds. Negative, zero, non-finite, malformed, HTML, script and path-like input is rejected. No expressions, parentheses or arbitrary code are executed.
Pythagorean theorem FAQ
What is the Pythagorean theorem?
In a right triangle, the sum of the squares of the two perpendicular legs equals the square of the hypotenuse: a² + b² = c².
How do I find the missing side of a right triangle?
For the hypotenuse, add the leg squares and take the square root. For a leg, subtract the known leg square from the hypotenuse square and take the positive square root.
How do I find the diagonal of a rectangle?
Use its width and length as perpendicular legs: diagonal = √(width² + length²).
Can I enter feet, inches, and fractions?
Yes. Use quote notation, mixed fractions, decimal feet or decimal inches. Metric millimeters, centimeters and meters are also supported. Bare ft/in input means inches.
What is the 3-4-5 method?
A triangle with side lengths in the ratio 3 : 4 : 5 has a right angle. Any proportional multiple, such as 6 : 8 : 10, has the same shape.
How do I check whether a layout is square?
For an intended rectangle, confirm matching opposite sides and compare both diagonals with each other and the calculated target. Equal diagonals are a practical check within your measuring tolerance.
What is the difference between rise, run, and slope length?
Rise is vertical change, run is horizontal change, and slope length is the diagonal between the endpoints.
How are the triangle angles calculated?
The first acute angle uses atan2(b, a) in degrees. Subtract it from 90° to obtain the other. Rise & Run reports the angle from horizontal.
Why might my measurement not match exactly in the field?
Tool accuracy, rounding, measuring tolerance, uneven surfaces, material movement and layout error can all affect the measured distance.
Does the Pythagorean theorem work for every triangle?
No. It applies specifically to right triangles. Other triangles require additional information and other relationships.
Sources
Reviewed October 1, 2026. OpenStax explains right triangles and the Pythagorean theorem. NIST supports length-unit definitions. Input limits, display precision and history behavior are product conventions. These sources do not endorse BuzCalculator.