Skip to main content

MATH · TRIANGLE

Triangle Calculator

Solve a triangle from three sides (SSS), two sides and an angle (SAS), or a right triangle from two sides. Computes all angles, area, and perimeter.

Input mode
Sides a, b, c
02 Sides
Side a3
Side b4
Side c5
03 Angles
Angle A36.8699°
Angle B53.1301°
Angle C90°
Area6

About This Calculator

A triangle has six elements — three sides and three angles. Given enough of them, the rest can be computed. This calculator handles SSS (all three sides), SAS (two sides and the angle between them), and right-triangle mode (two sides). It uses numerically stable implementations to handle near-degenerate triangles.

How It Works

Select the input mode. For SSS, enter all three side lengths. For SAS, enter two sides and the angle between them (in degrees). For right triangle, enter any two of the three sides. The calculator uses the law of cosines for angles, Heron's formula for area, and clamps floating-point arguments to valid domains to avoid NaN from rounding errors near degenerate cases.

The Formula

cos A = (b² + c² − a²) / (2bc) Area = √(s(s−a)(s−b)(s−c))

a, b, c
side lengths
A, B, C
angles opposite the corresponding sides

Frequently Asked Questions

What is the triangle inequality?
For a valid triangle, the sum of any two sides must exceed the third side (a+b>c, a+c>b, b+c>a). If this is violated the inputs cannot form a triangle and the calculator returns an error.
Why does the calculator use clamped arccos?
Floating-point arithmetic can produce arguments slightly outside [−1, 1] for the arccos function due to rounding. Without clamping, arccos returns NaN. The calculator clamps the argument to [−1, 1] before calling arccos, producing the nearest valid result.
Can I compute an obtuse triangle?
Yes. All three modes support obtuse triangles — the law of cosines handles angles greater than 90° correctly. The SAS angle input can be any value between 0° and 180°.