Triangle Calculator

Pick the combination you know (three sides, two sides and an angle, or two angles and a side), enter your numbers, and get every missing side and angle plus the area, the perimeter, and the exact steps we took to solve it.

SSS: you know all three sides.

Put this calculator on your website for free

Copy one snippet and give your visitors a working Triangle Calculator.

How this triangle calculator works

Every triangle has six parts: three sides (a, b, c) and three angles (A, B, C), where angle A sits opposite side a, B opposite b, and C opposite c. Give this calculator any valid combination of three parts (as long as at least one is a side) and it solves for the other three, then reports the area, the perimeter, and the triangle's classification. More importantly, it shows the working: every law of cosines and law of sines step appears with your actual numbers substituted in, so you can follow the solution line by line or check your own homework against it.

The five buttons describe what you know. SSS means three sides. SAS means two sides and the angle between them. ASA means two angles and the side between them. AAS means two angles and a side that is not between them. SSA means two sides and an angle that is not between them, and that last one is special: it can produce two different valid triangles, and when it does, we show you both.

The formulas

Law of cosines: a² = b² + c² − 2bc cos A
Law of sines: a / sin A = b / sin B = c / sin C
Angle sum: A + B + C = 180°
Area: √(s(s − a)(s − b)(s − c)) where s = (a + b + c) / 2, or (1/2)bc sin A

Here a, b, and c are the side lengths, A, B, and C are the angles opposite them in degrees, and s is the semi-perimeter. The square-root area formula is Heron's formula; the (1/2)bc sin A version is handy when you already know two sides and their included angle.

Which law do I use when?

Students often memorize both laws but freeze on which one to reach for. Here is the whole decision in two lines. Use the law of cosines when your known parts do not include a matched side-angle pair: three sides (SSS), or two sides with the included angle (SAS). Use the law of sines as soon as you have any side paired with its opposite angle: ASA and AAS get there instantly via the angle sum, and SSA starts with one pair already in hand.

A useful habit: the law of cosines opens the problem, the law of sines finishes it. In SAS, for example, one law of cosines step finds the missing side; after that you hold a full side-angle pair and the cheaper law of sines (or a second law of cosines, which this calculator prefers because it never gives an ambiguous answer) mops up the remaining angles.

The ambiguous SSA case, explained properly

SSA is the setup teachers warn about and rarely explain. Here is what is actually going on. Suppose you know angle A, its opposite side a, and one more side b. Picture side b fixed in place, hinged at angle A, with side a swinging from the far end like a gate trying to reach the baseline. Three things can happen:

No solution. Side a is too short to reach the baseline at all. Algebraically, the law of sines demands sin B = b sin A / a, and if that comes out greater than 1 there is no such angle, hence no triangle. This calculator tells you exactly that instead of failing silently.

One solution. If a is at least as long as b, the gate can only touch the baseline in one place; the "second" mathematical answer would force the remaining angle below zero. You get a single triangle.

Two solutions. If a is long enough to reach but shorter than b, the swinging side crosses the baseline in two places. Both crossings are legitimate triangles with the same three given measurements. The two versions of angle B are supplements of each other (they add to 180 degrees) because sine treats an angle and its supplement identically. When this happens we solve and display both triangles in full, because picking one silently would simply be wrong half the time.

Worked examples

SSS, sides 3, 4, 5: the inequality holds (3 + 4 > 5). Law of cosines: cos A = (16 + 25 − 9) / (2 × 4 × 5) = 0.8, so A = 36.87°; cos B = (9 + 25 − 16) / (2 × 3 × 5) = 0.6, so B = 53.13°; C = 180 − 36.87 − 53.13 = 90°. Heron: s = 6, area = √(6 × 3 × 2 × 1) = 6. A right scalene triangle, and the classic proof that 3-4-5 earns its reputation.

SAS, b = 8, c = 6, A = 60°: a² = 64 + 36 − 2 × 8 × 6 × cos 60° = 52, so a = 7.21. Then cos B = (52 + 36 − 64) / (2 × 7.21 × 6) gives B = 73.9°, C = 46.1°, and area = (1/2) × 8 × 6 × sin 60° = 20.78.

ASA, A = 30°, B = 70°, c = 10: C = 180 − 30 − 70 = 80°. Law of sines: a = 10 sin 30° / sin 80° = 5.08 and b = 10 sin 70° / sin 80° = 9.54; area = 23.85.

SSA, a = 6, b = 8, A = 40°: sin B = 8 sin 40° / 6 = 0.857. Since a < b, both B = 58.99° and B = 121.01° work, giving two triangles: one with C = 81.01° and c = 9.22, the other with C = 18.99° and c = 3.04. Two honest answers from one set of measurements.

The mistake that quietly ruins triangle homework

The single most common error is solving for a second angle with the law of sines and forgetting that the inverse sine on a calculator only ever returns acute angles. If the triangle's second angle is actually obtuse, the law of sines hands you its acute supplement and everything downstream is wrong, yet every step looks plausible. Two defenses: solve for angles opposite the shorter sides first (they are never obtuse), or do what this calculator does and use the law of cosines for angles whenever the sides are known, since inverse cosine distinguishes acute from obtuse on its own. And always finish with the sanity check that costs nothing: the three angles must total 180 degrees and the longest side must sit opposite the largest angle.

Frequently asked questions

How do I solve a triangle when I only know the three sides?

Use the law of cosines three times (or twice, then the angle sum). For angle A opposite side a, cos A = (b² + c² − a²) / (2bc). Take the inverse cosine to get the angle in degrees, repeat for a second angle, and subtract both from 180 for the third. This calculator does exactly that and shows each substitution.

What is the difference between ASA and AAS?

Both give you two angles and one side, so both start the same way: the third angle is 180 minus the two you know. The difference is where the side sits. In ASA the side is between the two angles; in AAS it is not. Either way, once all three angles are known, the law of sines finds the remaining sides.

Why does SSA sometimes give two different triangles?

Because the law of sines returns sin B, and two different angles share the same sine: an acute angle and its obtuse supplement. When the side opposite your known angle is shorter than the other given side, both angles can complete a valid triangle, so two genuinely different triangles fit the same three measurements. This calculator shows both.

How do I find the area of a triangle without the height?

Two standard ways. If you know all three sides, use Heron's formula: compute s = (a + b + c) / 2, then area = √(s(s − a)(s − b)(s − c)). If you know two sides and the angle between them, area = (1/2)ab sin C. No height measurement needed for either.

Why do my three sides not make a triangle?

Every pair of sides must add up to more than the third side. That is the triangle inequality. Sides like 1, 2, and 10 fail because 1 + 2 = 3, which cannot stretch across a gap of 10; the two short sides would lie flat and never meet. If one side is longer than the other two combined, no triangle exists.

How do I know if a triangle is acute, right, or obtuse?

Look at its largest angle. If the largest angle is under 90 degrees the triangle is acute, exactly 90 makes it right, and over 90 makes it obtuse. From sides alone, compare the square of the longest side to the sum of the squares of the other two: less means acute, equal means right, greater means obtuse.

Do the angles of a triangle always add up to 180 degrees?

In flat (Euclidean) geometry, yes, always, and this calculator relies on it: once two angles are known the third is forced. That is also why entering two angles that already total 180 or more gets rejected; there would be nothing left for the third angle.

Related calculators