a
Math

Triangle solver

Compute angles, area, heights and radii of a triangle from its three sides.

01Inputs

Enter the three side lengths. The calc applies law of cosines and Heron's formula.

02Results
Area (Heron)
A
B
C
Perimeter
Height to a
Inradius
Circumradius
Triangle visualization (sides + angles to scale)

Law of cosines: cos A = (b² + c² − a²) / (2bc), repeated for B and C. Heron's formula: area = √(s·(s−a)·(s−b)·(s−c)) with s = (a+b+c)/2. The triangle inequality requires every side to be less than the sum of the other two.

03How it works

Why this calculation

The triangle is the simplest planar polygon and the building block of trigonometry, surveying, navigation, and computer graphics. Solving a triangle — finding all six elements (three sides, three angles) from the available subset — is the canonical exercise in classical geometry. The most common case is SSS (three sides given): from the three side lengths, the law of cosines gives all three angles, Heron's formula gives the area, and elementary geometry gives heights, perimeter, inradius and circumradius. This calculator implements the SSS solve plus diagnostics — type classification (right/acute/obtuse, equilateral/isosceles/scalene) — and a scale-correct visual rendering.

The formula

Given sides a, b, c (must satisfy the triangle inequality: every side is strictly less than the sum of the other two; if not, no triangle exists):

  • Angles by law of cosines: cos A = (b² + c² − a²) / (2bc), cos B = (a² + c² − b²) / (2ac), C = π − A − B.
  • Area by Heron's formula: s = (a + b + c) / 2, area = √(s(s−a)(s−b)(s−c)).
  • Perimeter: a + b + c.
  • Heights (altitudes): h_a = 2·area / a; same for h_b, h_c.
  • Inradius (radius of inscribed circle, tangent to all three sides): r = area / s.
  • Circumradius (radius of the circumscribed circle, passing through all three vertices): R = (a · b · c) / (4 · area).
  • Type: equilateral if all sides equal; isosceles if exactly two equal; scalene otherwise. Right if any angle is 90 °, obtuse if any > 90 °, acute if all < 90 °.

How to use

Enter the three side lengths a, b, c. Any positive numbers work; the units are unspecified (cm, m, in, anything — the area comes out in the squared unit). The calc validates the triangle inequality first; if violated, it returns "–" and a one-line note. Otherwise it returns all six elements (three angles in degrees, three sides as entered), area, perimeter, three altitudes, inradius, circumradius, and a type classification, plus a scale-correct SVG diagram with vertex labels and angle annotations.

Worked example

Right triangle 3-4-5 (the classic Pythagorean triple).

  • Triangle inequality: 3 + 4 > 5 ✓.
  • Angle A (opposite a = 3): cos A = (16 + 25 − 9) / (2·4·5) = 32/40 = 0.8 → A = 36.87°.
  • Angle B (opposite b = 4): cos B = (9 + 25 − 16) / (2·3·5) = 18/30 = 0.6 → B = 53.13°.
  • Angle C (opposite c = 5): C = 180 − 36.87 − 53.13 = 90.00° (right!).
  • s = (3+4+5)/2 = 6. area = √(6·3·2·1) = √36 = 6.
  • Perimeter: 12.
  • Heights: h_a = 12/3 = 4; h_b = 12/4 = 3; h_c = 12/5 = 2.4.
  • Inradius: 6/6 = 1. Circumradius: (3·4·5)/(4·6) = 60/24 = 2.5 (= half hypotenuse, as expected for a right triangle).
  • Type: Right / Scalene.

Equilateral 6-6-6: angles all 60°, area = (√3/4)·6² ≈ 15.59, perimeter 18, heights all (√3/2)·6 ≈ 5.196, inradius √3 ≈ 1.732, circumradius 2√3 ≈ 3.464.

Pitfalls

Floating-point precision near degenerate triangles. A triangle with sides 1, 1, 1.999999 is barely valid; the law of cosines gives an angle very close to 180°, and small input errors blow up the computed angles. The calc handles the strict inequality (≤ rejected) but doesn't warn near-degenerate cases.

Triangle-inequality check is strict. Sides 3, 4, 7 fail (3 + 4 = 7, equality); the calc rejects. A "degenerate triangle" (collinear points) has area 0 and is geometrically not a triangle.

Right-angle detection floating-point. The calc detects right angles when |angle − 90°| < 0.01°. A genuinely right triangle entered with rounded sides (e.g., 7-7-9.9 instead of 7-7-9.899...) won't classify as Right; the type label gracefully falls back to Acute / Obtuse.

No SAS, ASA, AAS support. The calc only does SSS (three sides). For SAS (two sides + included angle), AAS (two angles + non-included side), or ASA (two angles + included side), you need the law of sines as a complementary tool. SSA is ambiguous (the "ambiguous case") and can have 0, 1, or 2 valid triangles.

Negative areas are nonsense. Heron's formula can return a complex number for invalid inputs; the calc filters via the triangle-inequality check first.

Coordinate-based input. Some users want to enter three (x, y) vertex coordinates instead of three side lengths. Compute the side lengths first (Euclidean distance) and feed those.

Spherical / hyperbolic triangles. The flat-plane formulas here assume Euclidean geometry. Triangles on a sphere (geodesics on Earth) have angle sums > 180°, and on hyperbolic surfaces < 180°. Different formulas (spherical law of cosines, etc.).

Legal / surveying triangulation. For real surveying you need angle-based methods (theodolite measurements), not just side lengths. The calc is for pure geometry, not practical land surveying.

Equilateral classification edge cases. Sides 5.000, 5.001, 5.000 are almost equilateral but technically isosceles. The calc uses a 0.001 tolerance; tighten or loosen as you need.

Variations

  • Right-triangle calculator: specialized for the SOH-CAH-TOA case, given two of {hypotenuse, leg, leg, angle}.
  • Trigonometric tables / unit circle: for plain sin/cos/tan of common angles.
  • Pythagorean triple generator: integer-side right triangles (3-4-5, 5-12-13, etc.).
  • Spherical triangle solver: for great-circle navigation on a sphere.
  • Coordinate geometry: vertex-input variant; compute side lengths from coords, then feed to SSS.

Related calculators