Find the straight-line distance between two points in two or three dimensions, exactly when the result is a whole number.
Pythagorean Theorem Calculator
Solve a right triangle for the hypotenuse or a missing leg, reported exactly for a Pythagorean triple.
- Free
- No sign-up
- Runs in your browser
Input
When solving for a leg, this is the hypotenuse.
A whole number, a decimal, or a fraction such as 3/4. Arithmetic is exact, so fractions stay exact.
How many digits to show when the answer is irrational. An exact answer ignores this.
Ready
Everything happens on this device. No upload, no account, no network request.
How to use this tool
- 1
Choose whether you are finding the hypotenuse or a leg.
- 2
When solving for a leg, the first length must be the hypotenuse - it is always the longest side.
Questions about Pythagorean Theorem Calculator
What is a Pythagorean triple?
Three whole numbers satisfying a^2 + b^2 = c^2, such as 3-4-5, 5-12-13 and 8-15-17. They are the cases where the answer is a whole number, and the tool reports them as exact rather than as a decimal that happens to look round.
Does this work for any triangle?
No, only right-angled ones. For any other triangle you need the law of cosines, which adds a term involving the angle: c^2 = a^2 + b^2 - 2ab cos(C). The Pythagorean theorem is that law with a right angle, where the cosine is zero.
Why does it refuse a leg longer than the hypotenuse?
Because the hypotenuse is always the longest side - it is opposite the largest angle. A leg longer than it describes no triangle, and the expression under the square root would be negative. Usually the two values have simply been entered the wrong way round.
Is my data sent anywhere?
No. This runs as JavaScript in your browser tab: there is no network request carrying your numbers, nothing reaches a server log, and it keeps working with your connection off. You can confirm it in the browser’s network panel.
Does the Pythagorean Theorem Calculator work offline?
Yes. Once the page has loaded it runs entirely as JavaScript on your own device, so the Pythagorean Theorem Calculator keeps working with the network switched off and nothing is ever sent to a server.
Related tools
Other tools you might reach for next.
Find the midpoint of two points exactly, in two or three dimensions.
Find the slope of the line through two points, with its equation and angle, reporting a vertical line as vertical rather than as infinity.
Evaluate an expression with exact fraction arithmetic, trigonometry, logarithms and factorials, reporting whether the result is exact.
Reduce a fraction to lowest terms, with its mixed number and exact decimal form including any repeating block.
Add two fractions exactly, showing the common denominator step and reducing the result.
Subtract one fraction from another exactly, showing the common denominator step.
Multiply two fractions exactly, multiplying across and reducing the result.