Right triangle calculator
Give any two sides of a right triangle and get the rest: legs of 3 and 4 return a hypotenuse of 5, an area of 6 and both acute angles in degrees. It works with a leg and the hypotenuse too. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- First leg
- 3
- Second leg
- 4
- Hypotenuse
- 5
- Angle a
- 36.8698976458
- Angle b
- 53.1301023542
- Angle right
- 90
A right triangle has one interior angle of exactly ninety degrees. The two sides that form that right angle are the legs, and the side opposite the right angle is the hypotenuse—always the longest side in a non-degenerate plane figure. Given any two of those three lengths, the third follows from the Pythagorean theorem, the two acute angles follow from inverse tangent or sine ratios, and the area is half the product of the legs. Students meet this pattern in homework, construction problems, and standardized tests that ask for a missing side or an angle without drawing software. Engineers, makers, and survey assistants need the same numbers when a sketch lists only two sides of a square corner.
What a right triangle is and which two sides determine the rest
In Euclidean plane geometry a right triangle is completely determined, up to congruence, once you fix the right angle and enough side data. The classical 3-4-5 triple is the textbook illustration: legs three and four force a hypotenuse of five, and the same arithmetic scales to any positive pair of legs. If instead you know one leg and the hypotenuse, the other leg is the positive square root of the hypotenuse squared minus the known leg squared—provided the hypotenuse is strictly longer than that leg.
Giving only the hypotenuse, or only one leg, leaves the figure under-determined: infinitely many right triangles share a single length. Giving all three sides over-specifies the problem and can hide inconsistency when the numbers fail Pythagoras. Search intent clusters around phrases like right triangle calculator, find missing side hypotenuse, Pythagorean theorem solver, and right triangle angles and area.
People want a numeric result they can check against a worksheet answer key, a CNC cut list, or a CAD note, not only a geometric argument that the figure is determined.
Practical use, limits, pricing, and delivery channels
Use the browser tool when you want an immediate right-triangle solution while checking homework, sizing a ramp, verifying a roof pitch sketch, or confirming a shop drawing without installing a computer-algebra system. Accepted sides must form a genuine right triangle with the hypotenuse strictly longer than each leg; units are whatever you already use for the figure, and the response lengths share that same unit. Results are fully deterministic: the same two known sides always yield the same missing side, angles, and area fields.
There is no language model, no external geometry service, and no randomness, so the capacity is safe to pin in continuous-integration checks and reproducible lesson materials.
What you can do with it
Homework and exam right-triangle drills
Students and graders confirm the missing side, both acute angles, and area for classic 3-4-5 style data, including rejection when the hypotenuse is not the longest side.
FAQ
Which formula finds the missing side?
With one leg and the hypotenuse, the other leg is the positive square root of hypotenuse² minus the known leg².
What happens if the hypotenuse is not the longest side?
A hypotenuse that is shorter than or equal to a leg cannot form a plane right triangle; those calls are not charged.
Is the right triangle calculator free?
The browser tool runs free on your device.
How are the acute angles computed?
The right angle is always returned as 90.
Why does the calculator need exactly two sides?
One side alone fits infinitely many right triangles, so nothing can be solved. Three sides over-specify the figure and can hide numbers that break Pythagoras, so two is exactly enough.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/geom/right-triangle \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"leg_a":3,"leg_b":4}'const res = await fetch("https://api.kit.forhosting.com/geom/right-triangle", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"leg_a": 3,
"leg_b": 4
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geom/right-triangle",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"leg_a": 3,
"leg_b": 4
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geom/right-triangle", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"leg_a":3,"leg_b":4}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"leg_a":3,"leg_b":4}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geom/right-triangle", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"leg_a": 3,
"leg_b": 4
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geom.right_triangle",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This capacity accepts exactly two of leg_a, leg_b, and hypotenuse, rejects pairs where the hypotenuse is not strictly longer than each leg, and returns the full set of sides, angles, and area as structured JSON.
What a right triangle is and which two sides determine the rest
Delivering leg_a, leg_b, hypotenuse, angle_a, angle_b, angle_right, and area as JSON makes the result easy to paste into notes, diff in automated tests, or feed into a larger pipeline without reimplementing square roots and degree conversion in every language you teach or deploy.
How this calculator validates input, applies Pythagoras, and finds angles and area
Each provided length must be a positive finite number. The engine counts how many of the three fields are present: zero or one fails as under-specified, all three fails as over-specified, and only pairs proceed. Area is half the product of the two legs. Edge cases are explicit: equal leg and hypotenuse, zero or negative lengths, non-numeric strings, and providing one or three sides all fail before any angle is returned. Send a JSON body with exactly two of the three side fields leg_a, leg_b, and hypotenuse. When both legs are known, the hypotenuse is the square root of leg_a squared plus leg_b squared. When leg_a and the hypotenuse are known, the engine first checks that the hypotenuse is strictly greater than leg_a; if not, it rejects the request with invalid_input because the hypotenuse must be the longest side. The missing leg_b is then the square root of hypotenuse squared minus leg_a squared. The symmetric case with leg_b and the hypotenuse works the same way. After the three sides are known, angle_a opposite leg_a is the two-argument arctangent of leg_a over leg_b in degrees, angle_b is the complementary acute angle opposite leg_b, and angle_right is always ninety. Results are rounded to a stable decimal precision so the same input always yields the same JSON.
Practical use, limits, pricing, and delivery channels
Each successful request is one billable item at $0.002; failed validation does not consume balance. Wire the endpoint into Pythagorean drills, contest answer checkers, engineering worksheets that list two of three sides, or floating preprocessing steps where you already prefer explicit domain errors over opaque black-box widgets that cannot show why a hypotenuse shorter than a leg is rejected.
Integration use cases
Deterministic fixtures for geometry tests
Pipelines that seed unit tests or interactive Pythagorean demos can call a pure right-triangle oracle instead of reimplementing square roots and arctangent in every language.
Shop drawings and ramp or roof pitch checks
Field or shop notes that record any two of rise, run, and diagonal recover the missing length plus angles and area as structured JSON for reports or lightweight CAD helpers.
Technical questions
How do I solve a right triangle with this API?
Send a JSON body with exactly two of leg_a, leg_b, and hypotenuse to geom.right_triangle. The response returns the missing side, angle_a, angle_b, angle_right (90), and area.