Triangle Calculator
Type any two sides — or a side and an angle — and the rest fill in.
How to use
This is a right-triangle solver. Type any two known values (two sides, or a side and an angle) and the calculator computes the remaining sides, the area, and both acute angles.
- Right triangle convention: side a is the rise (vertical), side b is the run (horizontal), side c is the hypotenuse (the slope).
- Angle α (alpha) is opposite side a; angle β (beta) is opposite side b. The two acute angles always sum to 90°.
- Type any two values — the calculator detects which two are known and solves the rest. Clear a field to reset that input.
- For non-right triangles, you need the law of sines / law of cosines — this calculator does not handle those.
Reviewed 6 June 2026 · methodology cited
About this calculator
Right-triangle math sits behind dozens of building problems: the length of a rafter for a known rise and run, the diagonal of a rectangular layout used to square it (the 3-4-5 rule), the slope of a ramp, the height of a ladder against a wall, the length of a brace, the diagonal of a square shaft, the slope of a stair stringer. All of these reduce to: given any two of (a, b, c, α, β), find the rest.
This calculator handles the right-triangle case — one of the three angles is exactly 90°. Type any two values into the form (two sides, or a side and an angle) and the remaining values fill in automatically. The area and perimeter update too. For triangles where no angle is 90°, you need the law of sines or law of cosines instead; this calculator does not handle the oblique case.
The math behind it
For a right triangle with legs a and b and hypotenuse c, the Pythagorean theorem says a² + b² = c². So c = √(a² + b²); a = √(c² − b²); b = √(c² − a²).
The angles relate to the sides through basic trigonometry: tan(α) = a/b, sin(α) = a/c, cos(α) = b/c. The complementary angle β satisfies α + β = 90°. From any one side and one angle, you can derive every other dimension: given a and α, b = a / tan(α), c = a / sin(α).
Area of a right triangle = a × b ÷ 2. Perimeter = a + b + c. So a 3-4-5 right triangle has area = 3 × 4 ÷ 2 = 6 square units, perimeter = 12 units, and angles 53.13° and 36.87° (the famous 3-4-5 ratio used to square corners on a job site).
Common right-triangle situations
| Application | Typical sides | Notes |
|---|---|---|
| Squaring a layout (3-4-5) | 3 ft × 4 ft → 5 ft diag | Mark 3 + 4, diagonal must = 5 → square |
| Squaring a 10×12 wall | 10 × 12 ft → ≈15.62 ft diag | √(100+144) — verify on site |
| Common rafter (4/12 pitch, 16 ft run) | rise 5.33 ft + run 16 ft | hypotenuse ≈ 16.87 ft (rafter) |
| Common rafter (8/12 pitch, 12 ft run) | rise 8 ft + run 12 ft | hypotenuse ≈ 14.42 ft |
| Stair stringer (8 risers @ 7.5″, 8 treads @ 10″) | rise 60″, run 80″ | stringer = √(60²+80²) = 100″ |
| Ramp (1:12 ADA, 36″ rise) | rise 3 ft, run 36 ft | length ≈ 36.12 ft, angle 4.76° |
| Ladder (10 ft tall, 4 ft from wall) | rise 10 ft, run 4 ft | ladder ≈ 10.77 ft, angle ≈ 68° |
| Diagonal brace (8 ft × 8 ft bay) | rise 8 ft + run 8 ft | brace ≈ 11.31 ft, 45° angle |
Building applications
The most common construction use of right-triangle math is squaring a layout. Stretch a tape diagonally across a rectangle; if the diagonal matches the Pythagorean value (a² + b² = c²) the corners are square. For a wall that should be 10 ft × 12 ft, the diagonal should measure √(10² + 12²) = √244 ≈ 15.62 ft. Any difference between measured and theoretical diagonal flags an out-of-square corner.
The 3-4-5 method is the same principle without the calculator. Mark 3 ft along one side and 4 ft along the other; the diagonal between those marks should be exactly 5 ft. If it is, your corner is square. This works at any scale — 6-8-10 (feet or inches), 9-12-15, 12-16-20 are all 3-4-5 multiples.
For rafters, side a is the rise, side b is half the building width (the run), and side c is the rafter length from ridge to bird's mouth (before adding tail or subtracting ridge thickness). For ramps, side a is the rise and side c is the ramp length; ADA / accessibility codes limit α to no more than 4.76° (1:12 slope). For stair stringers, a is the total rise, b is the total run, and c is the actual stringer length you cut from a 2×12.
Frequently asked questions
What is the Pythagorean theorem?
For any right triangle, the square of the hypotenuse (the longest side, opposite the right angle) equals the sum of the squares of the other two sides: a² + b² = c². So if a = 3 and b = 4, then c² = 9 + 16 = 25 and c = 5. This 3-4-5 ratio is the most famous example and is used on job sites to square corners without a calculator.
How do I square a foundation or wall layout?
Use the 3-4-5 method or its multiples. Mark 3 feet from the corner along one wall and 4 feet along the perpendicular wall. The diagonal between those two marks should measure exactly 5 feet. If it does, the corner is 90°. If the diagonal is shorter than 5 ft, the corner is greater than 90° (open); if longer, less than 90° (closed). Adjust the layout until the diagonal hits 5 ft exactly.
How do I calculate a rafter length?
For a common rafter, the rise is half the building width times pitch ÷ 12 (so for a 4/12 pitch over a 24 ft wide building, the run is 12 ft and the rise is 4 ft). The rafter length is the hypotenuse: √(rise² + run²) = √(16 + 144) = 12.65 ft theoretical length. Add a 12–24 inch tail for overhang and subtract half the ridge-board thickness from the top.
What is the angle of a 1:12 accessibility ramp?
A 1:12 ramp rises 1 inch for every 12 inches of horizontal run. The angle from horizontal is atan(1/12) = 4.76 degrees. ADA (US) and most Canadian accessibility codes set 1:12 as the maximum slope for an accessible ramp; gentler slopes (1:16 or 1:20) are preferred where space allows because they are easier to use with a wheelchair.
Does this calculator handle non-right triangles?
No. This solver assumes one angle is exactly 90°. For oblique triangles (no right angle), you need the law of sines (a/sin A = b/sin B = c/sin C) or the law of cosines (c² = a² + b² − 2ab·cos C). Use a general triangle solver or a calculator with trig functions for those cases.
Is this a structural-design tool?
No. It is a geometric calculator. Structural design — sizing rafters, stair stringers, ramps, braces — depends on load, span, material, and code, not just geometry. Use this calculator to confirm a dimension on a drawing or to lay out a square corner on site, but never to size structural members.