HomeGeometry › Right Triangle Calculator

Right Triangle Calculator

Solves a right triangle from any two of its sides (two legs, or one leg and the hypotenuse) using the Pythagorean theorem, and returns all sides, the two acute angles in degrees, area, perimeter and the altitude to the hypotenuse.

When to use

You know two sides of a right-angled triangle and need the third side, the angles or the area.

Do not use when: The triangle has no right angle (use triangle-solver) or you only need the hypotenuse length (pythagorean gives just that).

Formula

hypotenuse² = leg_a² + leg_b²; angle_a_deg = atan(leg_a / leg_b); angle_b_deg = 90 − angle_a_deg; area = leg_a × leg_b / 2; altitude = leg_a × leg_b / hypotenuse

Inputs

ParameterTypeUnitRequiredDescription
leg_anumberunitsnoFirst leg (side adjacent to the right angle). Range: > 0
leg_bnumberunitsnoSecond leg (side adjacent to the right angle). Range: > 0
hypotenusenumberunitsnoSide opposite the right angle; must be longer than either leg. Range: > 0

Outputs

OutputTypeUnitDescription
leg_anumberunitsFirst leg.
leg_bnumberunitsSecond leg.
hypotenusenumberunits√(leg_a² + leg_b²).
angle_a_degnumberdegreesAcute angle opposite leg_a = atan(leg_a / leg_b).
angle_b_degnumberdegreesAcute angle opposite leg_b = 90 − angle_a_deg.
areanumberunits²leg_a × leg_b / 2.
perimeternumberunitsleg_a + leg_b + hypotenuse.
altitude_to_hypotenusenumberunitsHeight from the right angle onto the hypotenuse = leg_a × leg_b / hypotenuse.

Example

Legs 3 and 4: {"leg_a":3,"leg_b":4}{"hypotenuse":5,"angle_a_deg":36.8699,"angle_b_deg":53.1301,"area":6,"perimeter":12,"altitude_to_hypotenuse":2.4}

Leg 5, hypotenuse 13: {"leg_a":5,"hypotenuse":13}{"leg_b":12,"angle_a_deg":22.6199,"angle_b_deg":67.3801,"area":30,"perimeter":30}

GET https://tttkmbb.com/api/v1/calculate/right-triangle?leg_a=3&leg_b=4

Machine access

Sources

FAQ

Which angle is angle_a_deg?

The angle opposite leg_a (at the vertex where leg_b meets the hypotenuse). The two acute angles always add up to 90°.

What if I enter all three sides?

They must satisfy leg_a² + leg_b² = hypotenuse² (to 0.01 %); otherwise an INVALID_PARAMETER error is returned. Give just two sides to avoid this.

Related calculators