ForHosting KIT · Math

Pythagorean theorem calculator

Enter any two sides of a right triangle and get the third plus the area: legs of 3 and 4 give a hypotenuse of 5 and an area of 6. The hypotenuse is always c, and impossible triangles are caught before they give nonsense. 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
Leg a
3
Leg b
4
You get
Hypotenuse c
5
Solved for
Hypotenuse c
Area
6

Need the missing side of a right triangle? Enter any two of a, b and c — where c is always the hypotenuse — and this free tool returns the third side and the area, instantly, without an account.

How the calculator works

A right triangle has exactly one right angle (ninety degrees). The side opposite that angle is the hypotenuse, always named c in this tool. The other two sides are the legs a and b.

The Pythagorean theorem states that the square of the hypotenuse equals the sum of the squares of the legs: a² + b² = c². A classic worked example is the 3-4-5 triple: if a is 3 and b is 4, then c is the square root of 9 + 16, which is exactly 5, and the area is half of 3 times 4, which is 6. Other common integer triples you can check instantly include 5-12-13 and 8-15-17.

Non-integer legs are fine too: with a equal to 1 and b equal to 1, c is the square root of 2, rounded to 1.4142135624, and the area is 0.5.

Which sides to enter

You must provide exactly two values—no more, no less. If you know both legs, leave c empty and the tool computes the hypotenuse from the square root of a squared plus b squared. If you know the hypotenuse and one leg, leave the other leg empty: the tool first checks that c is strictly greater than the known leg, then takes the square root of c squared minus that leg squared.

This guard rejects impossible geometry before a silent NaN can appear. Entering all three sides is not a verification mode; it is rejected with a clear invalid-input message, because the contract is to solve for the missing side, not to audit a triple. Null on a key is treated as not given for the presence count, so the cardinality rule still applies.

Area, precision, and edge cases

After the missing side is resolved, the area is always half the product of the two final legs, then rounded with the same ten-decimal rule as the sides. There is no optional flag: every successful response includes a, b, c, which side was computed, and the area. Extremely large inputs can overflow double range—for example legs near 1e154—so if the computed side or the area is not finite, the tool returns an out-of-range invalid-input error instead of a null or NaN field.

Extremely tiny positive values may round to zero after ten decimals; that is a documented limit of the rounding domain, not a crash. Use it for homework checks, site measures on a square corner, or quick geometry helpers when prototyping games and CAD sketches.

Homework and tutoring

Check textbook exercises quickly: classic 3-4-5 and 5-12-13 triples, or non-integer legs, without installing a CAS.

Site and workshop measures

From two measured lengths on a square corner, recover the diagonal or the unknown leg before cutting material.

Game and CAD helpers

Prototype collision radii or ramp lengths from two known axes without leaving the browser.

Is c always the hypotenuse?

Yes. By contract the field c is the hypotenuse; a and b are legs. The tool never guesses which side is longest.

Why do huge numbers fail?

If a² + b² overflows to infinity, the tool reports an out-of-range result instead of returning null or NaN.

How do I find the hypotenuse from the two legs?

Enter both legs and leave the hypotenuse empty. It is the square root of the sum of their squares, so legs of 3 and 4 give the square root of 9 plus 16, which is exactly 5.

How do I find a missing leg?

Enter the hypotenuse and the leg you know. The hypotenuse must be longer than that leg; the missing one is the square root of the hypotenuse squared minus the known leg squared.

Can I enter all three sides to check a triangle?

No. You must give exactly two sides, and entering three is refused, because the calculator solves for a missing side rather than testing a set of numbers.

How is the area of the triangle calculated?

It is half the product of the two legs, once the missing side is known. Legs of 3 and 4 give an area of 6, rounded to ten decimals like the sides.

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/dev/pythagoras

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/dev/pythagoras \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"a":1,"b":1}'
{
  "a": 1,
  "b": 1
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "dev.pythagoras",
  "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.

max_number1e+150
$whyBeyond ~1e154, a²+b² overflows double; handler rejects non-finite results as invalid_input.
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.

Which sides to enter

Zero, negative numbers, boolean values, and numeric-looking strings such as the characters three in quotes are also rejected: each given side must be a finite JavaScript number strictly greater than zero.

Area, precision, and edge cases

All of this runs free in your browser with the same pure function as the API path, without an account and without storing your numbers.

What if I enter all three sides?

The tool requires exactly two sides. Three values are rejected with an invalid_input error; it does not validate whether they form a Pythagorean triple.

How precise are the results?

Computation uses IEEE-754 doubles; every output number is rounded to ten decimal places with half-away-from-zero rounding.

Is my data sent to a server?

The free browser widget runs entirely on your device. The API path applies the same pure function without storing your numbers.

Read the full KIT documentation →