Triangle Calculator
Solve any triangle given sides and angles
Select what you know about the triangle, enter the values, and click Solve triangle to find all remaining sides, angles, perimeter, and area.
Solving triangles using the law of cosines and law of sines
A triangle has three sides and three angles. Knowing enough information about a triangle (a combination of sides and angles) allows you to calculate all the remaining unknowns. This process is called solving the triangle. The minimum information needed to uniquely define a triangle is three measurements, provided at least one is a side length. This calculator supports three standard combinations: three sides (SSS), two sides and the included angle (SAS), and two angles and one side (AAS).
To use the calculator, select the combination that matches the information you have, enter the known values in the corresponding fields, and click Solve triangle. The result will show all three sides, all three angles (in degrees), the perimeter, and the area. Angles are labelled A, B, and C opposite to sides a, b, and c respectively.
In SSS mode, enter all three side lengths. The calculator uses the law of cosines to find each angle: the cosine of angle A equals (b squared plus c squared minus a squared) divided by (2 times b times c). Once one angle is found, the others follow using the same formula or by subtraction from 180 degrees. The area is computed using Heron's formula: area equals the square root of s times (s minus a) times (s minus b) times (s minus c), where s is the semi-perimeter.
In SAS mode, enter sides a and b and the angle C between them. The third side c is found using the law of cosines: c squared equals a squared plus b squared minus 2 times a times b times the cosine of C. The remaining angles follow from the law of sines or the law of cosines. The area is one half times a times b times the sine of C, which is a compact and elegant formula when the included angle is known.
In AAS mode, enter angles A and B and side a. The third angle C is simply 180 minus A minus B. The remaining sides follow from the law of sines: b divided by sin(B) equals a divided by sin(A), so b equals a times sin(B) divided by sin(A). Side c follows similarly. The area is then computed using Heron's formula once all three sides are known.
The law of cosines and the law of sines
The law of cosines is a generalisation of the Pythagorean theorem. For any triangle with sides a, b, c and opposite angles A, B, C, the law states: c squared = a squared + b squared - 2ab cos(C). When angle C is 90 degrees, cos(C) = 0 and the law reduces to the familiar Pythagorean theorem c squared = a squared + b squared. For other angles, the cosine term adjusts for the deviation from a right angle.
The law of sines states that the ratio of each side to the sine of its opposite angle is constant within a given triangle: a / sin(A) = b / sin(B) = c / sin(C). This law is particularly useful in AAS and ASA configurations where you know two angles and a side, because the known ratio immediately gives the scale of the entire triangle.
These two laws together allow the solution of any non-degenerate triangle for which the given information is sufficient. The only configurations that cannot be solved are those with insufficient or contradictory information, such as three angles alone (which defines a shape but not a scale) or side lengths that violate the triangle inequality (where the sum of any two sides must be greater than the third).
Triangle inequality and valid triangles
Not every set of three positive numbers forms a valid triangle. The triangle inequality states that the sum of any two sides must be strictly greater than the third side. For example, sides of 1, 2, and 10 do not form a valid triangle because 1 plus 2 equals 3, which is less than 10. If you enter three side lengths that fail this test, the calculator will display an error rather than producing a meaningless result.
Similarly, in AAS mode, the two angles you enter must sum to less than 180 degrees. The third angle is the remainder, and if it is zero or negative, the triangle is degenerate (a straight line) or impossible. In SAS mode, the included angle must be strictly between 0 and 180 degrees. These constraints are enforced by the calculator to ensure that results are geometrically valid.
Area results are expressed in square units, using the same unit as the side inputs. All angle results are in degrees. If you need radians, multiply the degree value by pi divided by 180. The perimeter is the sum of all three sides in the same linear unit as the inputs.