Home › Geometry › 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
leg_a | number | units | no | First leg (side adjacent to the right angle). Range: > 0 |
leg_b | number | units | no | Second leg (side adjacent to the right angle). Range: > 0 |
hypotenuse | number | units | no | Side opposite the right angle; must be longer than either leg. Range: > 0 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
leg_a | number | units | First leg. |
leg_b | number | units | Second leg. |
hypotenuse | number | units | √(leg_a² + leg_b²). |
angle_a_deg | number | degrees | Acute angle opposite leg_a = atan(leg_a / leg_b). |
angle_b_deg | number | degrees | Acute angle opposite leg_b = 90 − angle_a_deg. |
area | number | units² | leg_a × leg_b / 2. |
perimeter | number | units | leg_a + leg_b + hypotenuse. |
altitude_to_hypotenuse | number | units | Height 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
- API:
GET https://tttkmbb.com/api/v1/calculate/right-triangle(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/right-triangle · Markdown: https://tttkmbb.com/geometry/right-triangle.md · JSON definition: https://tttkmbb.com/geometry/right-triangle.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="right-triangle" - OpenAPI operationId:
solve_right_triangle - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Right triangle (reference)
- Wikipedia – Pythagorean theorem (reference)
- Wolfram MathWorld – Right Triangle (reference)
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
- Triangle Solver — Solve triangles that are not right-angled.
- Triangle Area Calculator — Area only, by any of three methods.
- Pythagorean Theorem Calculator — Just the hypotenuse or a leg from the Pythagorean theorem.