📐 Right Triangle Calculator
Calculate missing sides, hypotenuse, perimeter, and area using the Pythagorean theorem.
Solving triangles from whatever you already know
A triangle is fully determined by three pieces of information, as long as at least one is a side. Which three you have decides which tool you reach for: Pythagoras for right triangles, the law of sines when you have a matched side and angle, and the law of cosines when you do not.
Right triangles
a² + b² = c²
With the two short sides, the hypotenuse is the square root of the sum of their squares. With the hypotenuse and one leg, the other leg is the square root of the difference. A 7 and 24 triangle has a hypotenuse of √(49 + 576) = √625 = 25.
Some side combinations give whole numbers and are worth recognising on sight: 3-4-5, 5-12-13, 8-15-17 and 7-24-25, along with any multiple of them. A 9-12-15 triangle is just 3-4-5 scaled by three.
The trigonometric ratios
| Ratio | Definition | Use it to find |
|---|---|---|
| sine | opposite / hypotenuse | An angle from those two sides, or a side |
| cosine | adjacent / hypotenuse | An angle from those two sides, or a side |
| tangent | opposite / adjacent | An angle from the two legs |
To find an angle rather than a ratio, use the inverse functions. In a triangle with the opposite side 6 and the adjacent side 8, the angle is atan(6/8) = 36.87 degrees.
Non-right triangles
Two laws cover everything else. The law of sines applies when you have an angle and its opposite side:
a / sin A = b / sin B = c / sin C
The law of cosines is the general case and reduces to Pythagoras when the angle is 90 degrees, since cos 90° = 0:
c² = a² + b² − 2ab × cos C
| You know | Use | Note |
|---|---|---|
| Three sides (SSS) | Law of cosines | Always one solution |
| Two sides and the angle between (SAS) | Law of cosines | Always one solution |
| Two angles and any side (AAS or ASA) | Law of sines | Always one solution |
| Two sides and a non-included angle (SSA) | Law of sines | Ambiguous: zero, one or two solutions |
SSA is the ambiguous case. With two sides and an angle not between them, there can be two valid triangles, because an angle and its supplement share the same sine. If a calculator gives you one answer for an SSA problem, check whether the second is also geometrically possible.
Area
Three formulas, depending on what you have. The familiar one is half base times height. With two sides and the included angle, use area = ½ab × sin C. With all three sides, use Heron's formula, where s is half the perimeter:
area = √[ s(s−a)(s−b)(s−c) ] where s = (a+b+c)/2
When a triangle cannot exist
The triangle inequality says any two sides must sum to more than the third. Sides of 3, 4 and 9 cannot form a triangle because 3 + 4 is less than 9. Angles must also sum to exactly 180 degrees in plane geometry, so any set of three angles that does not is impossible.
A worked example
A roof rafter spans 4.2 m horizontally and rises 1.8 m. The rafter length is √(4.2² + 1.8²) = √(17.64 + 3.24) = √20.88 = 4.57 m. The pitch angle is atan(1.8 / 4.2) = 23.2 degrees, and the cross-sectional area under the rafter is ½ × 4.2 × 1.8 = 3.78 m².
Frequently Asked Questions (FAQs)
How do I find the hypotenuse?
Square both short sides, add them, take the square root. For legs of 9 and 12, the hypotenuse is √(81 + 144) = √225 = 15. This only works for right triangles; for any other triangle you need the law of cosines.
What is the ambiguous case?
When you know two sides and an angle that is not between them, two different triangles can satisfy the same measurements, because sin(x) and sin(180° − x) are equal. Always check whether the alternative angle also produces a valid triangle before accepting a single answer.
Can I find the area from just the three sides?
Yes, with Heron's formula. Take half the perimeter, call it s, then the area is the square root of s(s−a)(s−b)(s−c). For sides 5, 6 and 7, s is 9 and the area is √(9 × 4 × 3 × 2) = √216 = 14.7.
Do the angles always add to 180 degrees?
In plane geometry, yes, always. On a curved surface they do not: a triangle on a sphere can have three right angles, summing to 270 degrees. Any triangle you draw on paper or on a site plan follows the 180-degree rule.
What is a Pythagorean triple?
A set of three whole numbers that satisfies a² + b² = c². The smallest is 3-4-5, and others include 5-12-13, 8-15-17, 7-24-25 and 9-40-41. Every multiple of a triple is also a triple, which is why builders use a 3-4-5 measurement to check a corner is square.
How do I know if three lengths can form a triangle?
Apply the triangle inequality: the two shorter sides must sum to more than the longest. If they are exactly equal, the three points lie on a straight line and the triangle has zero area.