Right Triangle Calculator
Solve a right triangle from any two sides — get the third side, both acute angles, area and perimeter using the Pythagorean theorem.
Leg a
3
Leg b
4
Hypotenuse c
5
Area
6
Angle A (opposite a)
36.87°
Angle B (opposite b)
53.13°
Perimeter
12
Angles are in degrees. Legs a and b meet at the 90° corner; c is the hypotenuse opposite it.
How to use
- Pick what you know: the two legs, or one leg and the hypotenuse.
- Type the two values into the fields.
- Read the remaining side, both acute angles (A opposite a, B opposite b), the area and the perimeter.
About this tool
ShowHide
Enter any two sides and the calculator returns the third, both acute angles, the area and the perimeter. The defaults are the 3-4-5 triangle every builder knows: its angles are 36.87° and 53.13°, and the reason a knotted 3-4-5 loop of string squares a corner is that those are the smallest whole numbers satisfying a² + b² = c². The next such triple is 5-12-13, at 22.62° and 67.38°.
Which mode you pick changes more than the labels. Given two legs, the hypotenuse comes from Math.hypot, which is deliberately overflow-safe: legs of 1e200 give 1.414e200 where squaring and adding would reach Infinity, and legs of 1e-200 give 1.414e-200 where the squares would underflow to zero. The two modes that take a leg and the hypotenuse have no such protection, because the missing leg has to come out of a subtraction, √(c² − a²), and subtracting two nearly equal numbers discards significant digits. With c = 100,000,000 and a = 99,999,999.99 the tool shows 1,414.2143 where the exact answer is 1,414.2136 — the last two digits on screen are already wrong. So when you have the two legs, enter the two legs.
Results are rounded to four decimals for display, the two acute angles always sum to 90°, and a hypotenuse shorter than or equal to the leg it is paired with describes no triangle at all, so the tool declines the input instead of returning a zero.
Frequently asked questions
What is the Pythagorean theorem?
For a right triangle, the square of the hypotenuse equals the sum of the squares of the two legs: a² + b² = c². The hypotenuse c is the longest side, opposite the right angle.
Which side is the hypotenuse?
The hypotenuse is the side opposite the 90° angle — always the longest of the three. The other two sides (the legs) form the right angle.
How are the angles found?
From the sides: angle A (opposite leg a) is arctan(a / b), and the two acute angles always add up to 90°, so B = 90° − A.
Why do I get an error with the hypotenuse?
The hypotenuse must be longer than either leg. If you enter a hypotenuse that is shorter than or equal to the leg, no valid triangle exists.
Can I enter an angle instead of a second side?
No — all three modes take two sides. If you have one leg and one acute angle A, the rest follows from b = a ÷ tan A and c = a ÷ sin A; compute one of those and feed the two sides back in. The tool deliberately stays on the side-based path because two sides always determine a right triangle, while a side plus an angle needs you to say which side you have.
How exact are the results at extreme sizes?
The two-legs mode uses Math.hypot, which does not overflow: legs of 1e200 still give a hypotenuse of 1.414e200 where squaring first would return Infinity. The hypotenuse modes subtract two nearly equal squares to recover the missing leg, and that loses digits when the hypotenuse and the known leg are close — with a leg of 1e10 and a hypotenuse one unit longer, the answer is good to about seven significant figures instead of fifteen. Ordinary sizes are unaffected.
Related tools
Triangle Solver: SSS, SAS, ASA, AAS & SSA
Solve any triangle from three known sides and angles — SSS, SAS, ASA, AAS or the ambiguous SSA case — with area, perimeter, radii, heights and medians.
Math & Statistics
Prime Factorization · GCD · LCM
Factor an integer into primes, list all divisors, and compute GCD and LCM of two numbers. Handles values up to ~10¹².
Math & Statistics
Combinations & Permutations Calculator
Compute nCr and nPr, with and without repetition, plus factorials — exact arbitrary-precision integers for probability, lottery odds and combinatorics.
Math & Statistics
Slope & Line Calculator
From two points, get the slope, the line equation y = mx + b, the distance, midpoint, angle of inclination, and rise/run.
Math & Statistics
Rule of Three Calculator
Solve a proportion a/b = c/d — enter any three values, leave one field empty, and the fourth is found by cross-multiplication.
Math & Statistics
Quadratic Equation Solver
Solve ax² + bx + c = 0 with the quadratic formula — real or complex roots, plus discriminant, vertex, axis of symmetry and sum/product of roots.
Math & Statistics