This free online right triangle calculator solves for the hypotenuse, area, perimeter, and both acute angles when you know the two legs of a right triangle. Enter side a and side b to get a complete breakdown of your triangle's measurements instantly.
How to Use the Right Triangle Calculator
Enter the length of "Side a" in the first input field.
Enter the length of "Side b" in the second input field.
Click "Calculate" to compute all triangle measurements.
Review the hypotenuse, area, perimeter, and angles in the results table.
How the Sides and Angles Are Labelled
Sides a and b are the two legs that meet at the right angle, C. Angle A is the angle opposite side a, and angle B is opposite side b. Because tan(A) = opposite ÷ adjacent = a ÷ b, the calculator finds angle A with the inverse tangent of a/b, converts it from radians to degrees, and gets angle B as 90° minus A, since the three angles must add up to 180°.
If you swap the two legs, angles A and B swap too, but the hypotenuse, area and perimeter stay the same. Lengths are rounded to three decimal places and angles to two.
Worked Example: Roof Rafter
A lean-to roof rises 1.5 m over a horizontal run of 4 m. Enter a = 1.5 (the rise) and b = 4 (the run). The calculator gives a rafter length (hypotenuse) of 4.272 m, a roof pitch (angle A) of 20.56°, and angle B of 69.44° where the rafter meets the wall. The area of 3 sq m is the triangular gable that would need cladding on each end, and the perimeter of 9.772 m is the total edge length of that gable.
The same approach works for a ramp: a rise of 0.6 m over a run of 7.2 m gives a ramp surface of 7.225 m at an angle of 4.76°. A slope is often described as a ratio of rise to run, here 1 : 12.
Special Right Triangles
Legs a, b
Hypotenuse
Angles A, B
Notes
5, 5
7.071
45°, 45°
Isosceles right triangle; hypotenuse = leg × √2
1, 1.732
2
30°, 60°
Half of an equilateral triangle; sides in the ratio 1 : √3 : 2
3, 4
5
36.87°, 53.13°
Whole-number sides, but the angles are not whole numbers
Getting More from the Results
Height to the hypotenuse: the perpendicular from the right angle to the hypotenuse equals a × b ÷ c. For the 3-4-5 triangle it is 12 ÷ 5 = 2.4.
Sine and cosine: once you have the hypotenuse, sin(A) = a ÷ c and cos(A) = b ÷ c. For the 3-4-5 triangle, sin(A) = 0.6 and cos(A) = 0.8.
If you know a leg and the hypotenuse instead of both legs, find the missing leg with the Pythagorean Theorem Calculator first, then enter both legs here.
Measure the legs at right angles to each other. If the corner is not truly 90°, the formulas no longer apply and every output will be off.
Frequently Asked Questions
It calculates the hypotenuse with c = √(a² + b²), area = (a × b) / 2, perimeter = a + b + c, angle A = atan(a/b) converted to degrees, and angle B = 90° - angle A.
For side a = 3 and side b = 4, the hypotenuse is 5, the area is (3×4)/2 = 6, the perimeter is 3+4+5 = 12, angle A ≈ 36.87°, and angle B ≈ 53.13°.
Yes, since this calculator assumes a right triangle where side a and side b form the right angle, angle C is always fixed at 90°.
Slope percentage is rise ÷ run × 100, which is a ÷ b × 100 when a is the vertical leg. A rise of 1.5 m over 4 m is a 37.5% slope, even though the angle is only 20.56°. Percentage and degrees are not interchangeable: a 100% slope is 45°.
Not with this tool, which needs both legs. You can find the second leg yourself first: if you know leg b and angle A, then a = b × tan(A). Enter both legs to get everything else.