ForHosting KIT · Math

Triangle side calculator

Legs of 3 and 4 give a hypotenuse of 5. Enter the two sides of a right triangle you already know, choose whether the missing one is the hypotenuse or a leg, and get it from the Pythagorean theorem. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
A
3
B
4
Calculate
Hypotenuse
You get
Missing side
5
Missing role
hypotenuse
Legs
3, 4
Hypotenuse
5

A right triangle has two legs and one hypotenuse that obey the Pythagorean theorem: the square of the long side equals the sum of the squares of the two shorter sides. When any two of those three lengths are already known, the third is not a guess and not a trigonometric solve from an angle: it is a square root of a sum or of a difference of squares. Students, tutors, shop drawings, and exam graders all need that missing side without mixing it up with a full right-triangle solver that also returns angles and area, or with a hypotenuse-only landing that talks only about the long side.

How two known sides determine the missing one

In a right triangle the Pythagorean theorem is the whole algorithm: a squared plus b squared equals c squared, where c is the side opposite the right angle and a and b are the legs. Rearrange that identity in the two ways this calculator supports. If both known lengths are legs, the missing side is the hypotenuse, and you compute c as the square root of a squared plus b squared.

If one known length is the hypotenuse and the other is a leg, the missing side is the remaining leg, and you compute it as the square root of c squared minus the known leg squared. When you ask for the hypotenuse, both numbers are treated as legs. When you ask for a leg, the longer of the two known sides is treated as the hypotenuse and the shorter as the other leg, which is the only assignment that can produce a positive remainder under the theorem.

Equal known sides cannot produce a missing leg, because the remainder under the square root would be zero and a zero-length side is not a triangle. No angles, no inverse trigonometric functions, and no special 30-60-90 or 45-45-90 ratio tables appear here: two positive sides plus which side is missing determine the third uniquely, and that length is the only quantity this capability is built to return.

Where a triangle-side calculator earns its keep

Classrooms and tutoring platforms use a triangle side calculator so learners can confirm the Pythagorean theorem on arbitrary pairs without mixing that one square root up with a full right-triangle solver that also dumps angles and area, or with a hypotenuse-only page that never recovers a missing leg.

Shop drawings, framing layouts, ramp checks, and simple CAD macros often already know two of the three edges of a right corner and only need the third before they can place a cut, a brace, or a warning that the figure will not close. Failed validation does not consume balance. If you later need the acute angles, the area, or a special-ratio 30-60-90 table, call a dedicated sibling rather than stretching this contract.

Classroom and homework checks

Let students submit two known sides and whether the missing side is the hypotenuse or a leg, then verify the Pythagorean result including the cases that must be refused.

Exam and LMS auto-grading

Mark missing-side items with a deterministic oracle that rejects non-positive or non-finite known sides instead of returning a dummy zero.

Shop drawings and layout close-out

Turn two measured edges of a right corner on a plan, ramp, or frame into the third side before placing a cut, a brace, or a close-out dimension.

What happens if a known side is zero, negative, or not a finite number?

A side of a triangle must be a positive finite length, so those values are not billed as a success.

Why must the two known sides differ when I ask for a leg?

If both known sides are equal, treating the longer as the hypotenuse leaves a zero remainder.

How do I find the hypotenuse from the two legs?

Square both legs, add the two squares and take the square root of the total. For legs of 3 and 4 that is √(3² + 4²), a hypotenuse of exactly 5.

How do I find a missing leg of a right triangle?

Choose the leg option and enter the hypotenuse and the leg you know. The calculator subtracts the square of the leg from the square of the hypotenuse and takes the root, so 5 and 3 give a leg of 4.

Does the order in which I enter the two sides matter?

No. When you ask for a leg, the longer of the two sides is always taken as the hypotenuse, and when you ask for the hypotenuse both are treated as legs. You can type them in either order.

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.

POSThttps://api.kit.forhosting.com/math/triangle-side

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.

curl -X POST https://api.kit.forhosting.com/math/triangle-side \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":3,"b":4,"solve_for":"hypotenuse"}'
{
  "a": 3,
  "b": 4,
  "solve_for": "hypotenuse"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "math.triangle_side",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

This triangle side calculator accepts two positive finite side lengths and a solve_for choice of hypotenuse or leg, rejects any known side that is not positive and finite, and returns the missing side length together with the completed legs and hypotenuse.

How two known sides determine the missing one

The calculator does not ask you to name a, b, and c as three optional blanks: you send the two lengths you already have as a and b, then set solve_for to hypotenuse or to leg. Non-positive or non-finite known sides are also impossible lengths, so they fail as invalid_input instead of returning a dummy zero. That matches classroom language, which says those two numbers cannot be the two known sides of a right triangle, and it matches API clients, which treat empty success and hard failure differently for billing and retries.

Input contract, response shape, and error behaviour

Every known side must be strictly greater than zero: a zero length collapses an edge, and a negative length is not a geometric distance. Zero, a negative, Infinity, or NaN on either known side is refused and is not billed. POST a JSON body with two required finite numbers and one required choice: a and b, the known side lengths, and solve_for, which must be hypotenuse or leg. Aliases side_a, leg_a, and side1 are accepted for the first length; side_b, leg_b, and side2 for the second; missing, find, and unknown for the choice, so scripts that already use textbook labels do not need a rename step. Each length may arrive as a JSON number or as a numeric string; missing fields, empty strings, and non-finite values fail with invalid_input naming the field. For hypotenuse it returns missing_side as the hypot of a and b, missing_role hypotenuse, legs echoing the two inputs, and hypotenuse equal to that result, with formula c equals the square root of a squared plus b squared. For leg it takes the longer known side as c and the shorter as the other leg, refuses the request when the two sides are equal, and otherwise returns missing_side as the stable square root of c minus the known leg times c plus the known leg, missing_role leg, and the completed pair of legs. Example: three and four with solve_for hypotenuse yield a missing side of five, the classic 3-4-5 triple. Five and twelve with solve_for hypotenuse yield thirteen. Five and four with solve_for leg yield three, because five is the hypotenuse and four is a known leg. The endpoint does not return interior angles, does not return area, and does not accept a third length to verify consistency; those are different search intents served by other capabilities.

Where a triangle-side calculator earns its keep

Exam-prep generators and LMS auto-graders need a deterministic oracle that marks non-positive sides as invalid_input instead of silently returning zero, which a buggy grader might treat as a successful missing side. Keep requests small, pin the missing_side field in tests, and you get a reproducible two-side check for homework, LMS plugins, and edge workers without standing up a computer-algebra system of your own.

How do I find the missing side of a right triangle from the other two sides?

Send two positive finite lengths as a and b, and set solve_for to hypotenuse or leg. The API returns missing_side as √(a²+b²) or as √(c²−leg²) using the longer known side as the hypotenuse.

Can I recover a missing leg, or only the hypotenuse?

Both. Set solve_for to hypotenuse when a and b are the legs, or to leg when the longer known side is the hypotenuse and you need the remaining leg.

What does the triangle side calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →