a
Math

Right triangle calculator

Sides, angles, area, hypotenuse via Pythagoras and SOHCAHTOA.

01Inputs

Naming convention: a and b are the two legs (cathetus), c is the hypotenuse. Angle A is opposite side a; angle B is opposite side b; the right angle sits at vertex C.

02Results
Leg a
Leg b
Hypotenuse c
Area (½·a·b)
Angle A
Angle B
Perimeter
Inradius / Circumradius
/
Right triangle (to scale)

Pythagoras: a² + b² = c². SOHCAHTOA: sin A = a/c, cos A = b/c, tan A = a/b. The right angle (90°) sits at vertex C, with B = 90° − A. Area = ½·a·b, inradius = (a + b − c) / 2, circumradius = c / 2.

03How it works

Why this calculation

The right triangle is the most useful single shape in applied geometry. It bridges abstract trigonometry to concrete tasks like measuring a roof pitch, sizing a ladder against a wall, computing the diagonal of a TV screen, laying out a square corner with a builder's framing, surveying a field, or deriving the distance between two GPS coordinates over short distances. The defining property — one 90° angle — collapses the general triangle problem into a small set of clean closed-form formulas: Pythagoras gives the relationship between the three sides, and the SOHCAHTOA mnemonic gives the relationship between any one acute angle and a pair of sides. Once you know two of the four "free" quantities (two legs, two angles, or any one leg with the hypotenuse, or any one acute angle with one side), the other two are determined uniquely. This calculator implements all six common solve modes, returns every derived quantity, and renders the resulting triangle to scale so you can sanity-check the geometry visually before committing materials, code, or coordinates.

The formula

Sides are labelled by convention: a and b are the two legs (the cathetus pair), c is the hypotenuse (the side opposite the right angle). Vertices A, B, C sit opposite the side of the same lower-case name; the right angle (90°) is at C. The two acute angles A and B always satisfy A + B = 90°.

  • Pythagoras: a² + b² = c².
  • SOHCAHTOA at angle A: sin A = a/c (opposite over hypotenuse), cos A = b/c (adjacent over hypotenuse), tan A = a/b (opposite over adjacent). Apply the same trio at angle B by swapping a ↔ b.
  • Inverse trig to recover an angle from any two sides: A = atan(a/b) = asin(a/c) = acos(b/c).
  • Area: ½ · a · b (the two legs are perpendicular, so they double as base and height).
  • Perimeter: a + b + c.
  • Inradius (radius of the inscribed circle, tangent to all three sides): r = (a + b − c) / 2. The −c term is what makes a right triangle's inradius pleasantly compact.
  • Circumradius (radius of the circle through all three vertices): R = c / 2. Equivalently, the hypotenuse is a diameter of the circumscribed circle (Thales' theorem).
  • Heights from each vertex: h_C = (a · b) / c (foot lands on the hypotenuse); h_A = b and h_B = a (the legs are themselves altitudes).

How to use

Pick the solve mode that matches what you already know:

  • Two legs known (a + b) — the most common case. Returns hypotenuse c by Pythagoras and both acute angles by inverse tangent.
  • Leg a + hypotenuse c — solves for the missing leg b and both angles. The calc rejects c ≤ a (a leg cannot exceed the hypotenuse).
  • Leg b + hypotenuse c — symmetric to the previous mode.
  • Angle A + leg a (opposite to A) — solves the rest using sin and tan of A.
  • Angle A + leg b (adjacent to A) — solves the rest using tan and cos of A.
  • Angle A + hypotenuse c — solves the rest using sin and cos of A.

Then enter the requested values in the visible fields. The to-scale SVG diagram updates live so you can confirm the triangle "looks right" — a useful sanity check when an input is off by an order of magnitude. The calc internally converts angles from degrees to radians (JavaScript's Math.sin/cos/tan work in radians); the displayed angles always come back in degrees for human comprehension.

Worked example

Take the famous 3-4-5 triangle: legs a = 3, b = 4. Pythagoras: c = √(3² + 4²) = √25 = 5. Angle A = atan(3/4) ≈ 36.87°. Angle B = 90 − 36.87 ≈ 53.13°. Area = ½ · 3 · 4 = 6 square units. Perimeter = 3 + 4 + 5 = 12. Inradius r = (3 + 4 − 5)/2 = 1. Circumradius R = 5/2 = 2.5 (the centre of the circumscribed circle is the midpoint of the hypotenuse — Thales). The 3-4-5 triple was used by Egyptian "rope-stretchers" to lay out right angles for monumental architecture more than 4,000 years ago: tie 12 evenly spaced knots in a rope, fold into a triangle of 3, 4, and 5 units, and the angle between the 3-side and the 4-side is provably 90°. No theodolite required.

A second example: a roof with run b = 5 m and pitch angle A = 30°. Mode "Angle A + leg b": rise a = 5 · tan(30°) ≈ 2.887 m; rafter length c = 5 / cos(30°) ≈ 5.774 m; angle B = 60°. Useful for cutting rafter blanks before any wood touches the saw.

Pitfalls

  • Degrees versus radians. The calculator accepts angles in degrees but converts to radians internally. If you paste a value computed elsewhere in radians (say 0.524 instead of 30°), every result will be wildly off. Convert first: degrees = radians · 180/π.
  • Confusing opposite, adjacent, and hypotenuse. Opposite means "across from the angle you're looking at"; adjacent means "next to it (and not the hypotenuse)"; hypotenuse is the longest side, always opposite the right angle. The same physical leg switches between "opposite" and "adjacent" depending on which acute angle you reference.
  • asin / acos domain errors. The arguments of asin and acos must be in [−1, 1]. If you ask for the angle whose sine is 1.2, the math is undefined. Translates here to "leg cannot exceed hypotenuse"; the calc rejects c ≤ a (or c ≤ b) up front to avoid emitting NaN.
  • Right-angle naming. Convention puts the right angle at vertex C and the hypotenuse opposite it. Some textbooks place the right angle at A; mixing conventions silently swaps a and b. Sticking to one convention prevents subtle errors when copy-pasting between sources.
  • Pythagorean triples. Integer-sided right triangles like 3-4-5, 5-12-13, 7-24-25, 8-15-17, 9-40-41 and 20-21-29 show up repeatedly in puzzle problems. They are not the only right triangles — most have irrational sides — but they are convenient when you want clean numbers. Multiples of any triple (6-8-10, 9-12-15, …) are also right triangles.
  • Congruence versus similarity. Two right triangles are similar (same shape, possibly different size) if their acute angles match; they are congruent (identical) only if at least one matching side length also agrees. The calculator returns absolute side lengths — be careful when comparing two triangles to specify which property you mean.
  • Off-by-one when entering angle in radians by accident. A 1-radian angle is about 57.3°. If results look like the triangle has nearly collapsed (B ≈ 33°, all sides distorted) and you intended A = 30°, double-check the unit field.
  • Floating-point near 90°. Angles approaching 90° make tan(A) blow up (the adjacent side approaches zero). The calc clamps inputs to A < 90° and recommends working with the equivalent angle B = 90 − A in that regime.

Variations

  • 30-60-90 special triangle. Side ratios are 1 : √3 : 2 (opposite 30°, opposite 60°, hypotenuse). Memorising this saves time on geometry exams and any work involving equilateral-triangle bisection.
  • 45-45-90 isosceles right triangle. Side ratios 1 : 1 : √2. Comes from cutting a square along its diagonal. The diagonal of any unit square is √2 ≈ 1.414.
  • General (oblique) triangles. When no angle is 90°, the right-triangle shortcuts no longer apply — use the law of cosines (c² = a² + b² − 2ab cos C) and the law of sines (a/sin A = b/sin B = c/sin C). For SSS (three sides given), see the dedicated triangle-solver calc on this site.
  • 3D right triangles. The diagonal of a rectangular box with edges a, b, c is √(a² + b² + c²) — a chained Pythagorean computation. Same logic gives the space diagonal of a cube as side · √3.
  • Trigonometric identities like sin² + cos² = 1, sin(A+B) = sin A cos B + cos A sin B, and the half-angle formulas all derive from right-triangle relationships projected onto the unit circle.
  • Surveying and navigation. Triangulating an unknown point from two known landmarks reduces to a chain of right triangles. GPS receivers solve a 4-satellite trilateration that, over short baselines, looks Euclidean and bottoms out in repeated Pythagoras applications. Maritime navigation's "running fix" uses two bearings on the same landmark separated in time, plus a known travel distance, to fix position via right-triangle geometry.

Related calculators