Tools · Math & Statistics

Triangle Solver

Give it the three measurements that fix a triangle and it returns the other three, with the area, the perimeter, and what kind of triangle you have. Four ways in: three sides, two sides and the angle between them, two angles and the side between them, or two lengths of a right triangle.

Refuses number sets that are not trianglesHow it worksInputs stay on this device
Your inputs

Three sides

Each of these fixes one triangle and no other. Two sides and an angle that is not between them does not, which is why there is no SSA option.

Any of the three sides. The letters are only labels — a, b and c can be entered in any order.

The second side. Lengths carry no units here: whatever you put in comes back out.

The third side. It cannot be longer than the other two put together.

Your inputs are calculated locally and are not stored.
Area6

A scalene right triangle. Sides of 3, 4 and 5 meet at 36.87°, 53.13° and 90°, enclosing an area of 6 inside a perimeter of 12.

Side a
3
Side b
4
Side c
5
Perimeter
12
Area
6
Shape
scalene and right
Each vertex, the angle there, and the side across from it
VertexAngleOpposite side
A36.87°a = 3
B53.13°b = 4
C90°c = 5
  • The three angles are printed so they total exactly 180°. Two are computed and the third is what is left of a half turn, because three independent arc-cosines do not add up cleanly in binary arithmetic.
  • Lengths carry no units. Enter centimetres and the perimeter is in centimetres and the area in square centimetres — the arithmetic never needs to know which.
  • Angles are rounded to a hundredth of a degree and lengths to four decimals, and the shape is named from those rounded figures, so the label always agrees with the numbers beside it.
Formula & methodology

Three laws, and knowing which applies

A triangle has six parts — three sides and three angles — and any three of them, with one exception, determine the rest. Which law does the work depends on which three you have.

c² = a² + b² − 2ab·cos C  •  a ÷ sin A = c ÷ sin C  •  Area = √(s(s−a)(s−b)(s−c))
a, b, c
The three sides, each named for the angle opposite it
A, B, C
The angles at the three vertices, in degrees
s
The semi-perimeter, (a + b + c) ÷ 2

The law of cosineshandles both modes that start from sides. Rearranged as cos A = (b² + c² − a²) ÷ 2bc it turns three sides into an angle; left as written it turns two sides and the angle between them into the third side. Pythagoras is the same law with C set to 90°: cos 90° is 0, the last term vanishes, and c² = a² + b² is what is left. There is only one law here, and the right-triangle case is its easiest instance.

The law of sines handles the mode that starts from angles. Two angles fix the third by subtraction, and each side is then the known side scaled by the ratio of two sines.

For area, Heron’s formulais used when all three sides are known, because half base times height needs a height and the height is rarely one of the numbers you have. In the other three modes ½ab·sin C is exact and quicker. Heron is applied in W. Kahan’s rearrangement, which sorts the sides before multiplying: the textbook form loses about half its significant digits on a long thin sliver, where the semi-perimeter and the longest side agree to many decimal places before they differ.

The rule behind the rejections

Two sides have to out-reach the third

Ask for a triangle with sides of 3, 4 and 9 and this page refuses, and the reason is worth seeing once because it makes the rule obvious forever. Lay the 3 and the 4 flat along the 9, end to end. Together they cover 7 of it and leave a gap of 2. Now lift the joint between them to try to close the triangle: every degree you bend brings their far ends closer together, not further apart. Straight was as far as they could ever reach, and straight was not far enough.

That is the whole triangle inequality — any two sides, laid end to end, must be longer than the third — and it has to hold for all three pairs, not just the obvious one. Euclid proves it as Proposition 20 of Book I of the Elements, where it is sometimes dismissed as the fact a donkey knows, since a donkey walking to a pile of hay takes the direct route rather than two sides of a triangle.

The equality case is refused too. Sides of 3, 4 and 7 do meet, but only by lying flat in a straight line: no height, no area, and no angles worth reporting. Returning “area 0” for that would be technically true and practically a bug, so it is named as a failed inequality instead.

Worked example

The 3-4-5, from three sides to six parts

Start with sides a = 3, b = 4, c = 5. For the angle at A, the law of cosines gives cos A = (4² + 5² − 3²) ÷ (2 × 4 × 5) = 32 ÷ 40 = 0.8, and the angle whose cosine is 0.8 is 36.87°. For B: cos B = (3² + 5² − 4²) ÷ (2 × 3 × 5) = 18 ÷ 30 = 0.6, giving 53.13°. The third angle is what is left of a half turn: 180 − 36.87 − 53.13 = 90°, which is why the ratio 3∶4∶5 squares a corner on a building site with nothing but a tape measure.

For the area, the semi-perimeter is (3 + 4 + 5) ÷ 2 = 6, and Heron’s formula gives √(6 × 3 × 2 × 1) = √36 = 6. Check it against the right angle: ½ × 3 × 4 = 6. The perimeter is 12, the sides are all different so the triangle is scalene, and the largest angle is exactly 90° so it is right.

Switch to two sides and the angle between them and the same machinery runs the other way. Sides of 5 and 7 with 60° between them give c² = 25 + 49 − 2 × 5 × 7 × cos 60° = 74 − 35 = 39, so the third side is √39 = 6.245. The area is ½ × 5 × 7 × sin 60° = 15.1554, and the remaining angles come back as 43.90° and 76.10° — which, with the 60° you supplied, add to exactly 180.

The case that is missing

Why there is no SSA option

Three sides fix a triangle. Two sides and the angle between them fix a triangle. Two angles and the side betweenthem fix a triangle. Those are Euclid’s three congruence criteria, and they are the three modes on this page. Two sides and an angle that is not between them — SSA — is the famous exception, and it fixes nothing.

Here is why. Draw the known angle, and run one known side out along one of its arms. Now you have to place the second known side so that it reaches from the far end of the first back down to the other arm. Think of it as a compass: put the point at the end of the first side, open it to the length of the second, and sweep. If the second side is shorter than the first, that arc crosses the arm twice, and both crossings are real triangles.

With sides of 5 and 7 and a 40° angle opposite the 5, the two answers are a triangle with angles 40°, 64.15° and 75.85° and a third side of 7.5428, and a triangle with angles 40°, 115.85° and 24.15° and a third side of 3.1819. Their areas are 16.97 and 7.16. These are not near-misses of each other; they are different triangles that satisfy the same three numbers. Depending on the lengths, SSA can also give exactly one triangle or none at all, which is why it is called the ambiguous case and why offering it as a mode would mean quietly choosing for you.

Assumptions

What this calculator assumes

  • The triangle is flat. Angles sum to 180° only in plane geometry. On a sphere they sum to more, which is why a triangle drawn on the Earth with long enough sides does not behave like this one.
  • Lengths carry no units. Enter centimetres and the perimeter is in centimetres and the area in square centimetres. Mixing units within one triangle silently produces nonsense, because nothing here can tell.
  • Degrees, not radians. Every angle in and out is in degrees. A 1.5 typed where 1.5 radians was meant is a valid and very different triangle.
  • Sides between 0.1 and 10,000, angles up to 179°. The answer is held to those same bounds, so an ASA pair whose angles are nearly a straight line is rejected rather than returned at a precision the rest of the page does not have.
  • Rounding comes before naming. Angles are rounded to a hundredth of a degree, lengths to four decimals, and the shape is classified from those rounded figures — so a triangle shown with a 90.00° angle is never labelled acute.
Common questions

Triangle FAQ

What is the triangle inequality?

Any two sides of a triangle, laid end to end, have to be longer than the third. Try it with sides of 3, 4 and 9: lay the 3 and the 4 flat along the 9 and they cover 7 of it, leaving a two-unit gap that nothing can close — and bending them upward at the joint only shortens the span they cover, never lengthens it. So no triangle has those sides. The equality case is the flat one: 3, 4 and 7 lie in a straight line and enclose no area at all, which is why this calculator rejects it too rather than reporting a triangle of area zero.

Why is there no SSA option — I know two sides and an angle?

Because two sides and an angle that is not between them do not describe one triangle. Take sides of 5 and 7 with a 40° angle opposite the 5. Swing the side of length 5 down from the far end of the 7 and it crosses the third line in two different places, giving two genuinely different triangles: one with angles 40°, 64.15° and 75.85° and a third side of 7.5428, and one with angles 40°, 115.85° and 24.15° and a third side of 3.1819. Their areas are 16.97 and 7.16 — not close. A calculator that answered that question with a single triangle would be picking one and hiding the other, so this one does not offer the mode.

How do I find the angles when all I know is the three sides?

The law of cosines, rearranged to give the angle instead of the side: cos A = (b² + c² − a²) ÷ 2bc, then take the inverse cosine. For 3, 4 and 5 that is (16 + 25 − 9) ÷ 40 = 0.8, and the angle whose cosine is 0.8 is 36.87°. Do it once more for B, then subtract both from 180° to get C. Computing the third angle the same way rather than subtracting is what makes some solvers print three angles that add to 179.99°.

Which area formula should I use when I do not know the height?

Heron's formula if you know all three sides — take the semi-perimeter s = (a + b + c) ÷ 2 and the area is √(s(s−a)(s−b)(s−c)). Half base times height needs a height, and the height of a triangle is rarely one of the numbers you actually have. If instead you know two sides and the angle between them, ½ab·sin C is quicker and exact. This page uses Heron in SSS mode and ½ab·sin C in the other three.

Is a 3-4-5 triangle always a right triangle?

Yes, and so is any triangle whose sides are in that ratio — 6-8-10, 30-40-50, 1.5-2-2.5. It works because 3² + 4² = 9 + 16 = 25 = 5², which is the converse of Pythagoras: if the squares on two sides add to the square on the third, the angle between those two sides is a right angle. That is the reason a 3-4-5 measurement squares a corner on a building site with nothing but a tape measure.

Can a triangle have two right angles?

No. The three angles of a plane triangle add to exactly 180°, so two right angles would use all of it and leave nothing for the third corner — the two sides would be parallel and would never meet. The same arithmetic rules out two obtuse angles. Every triangle has at least two acute angles, and the largest angle is the one opposite the longest side, which is how this calculator decides whether to call a triangle acute, right, or obtuse.

Primary sources

Sources and review notes

  1. Euclid, Elements, Book I (David E. Joyce’s edition, Clark University) — Proposition 20 for the triangle inequality, and Propositions 4, 8 and 26 for the SAS, SSS and ASA congruence criteria that are the four modes on this page
  2. W. Kahan, “Miscalculating Area and Angles of a Needle-like Triangle” — the stable rearrangement of Heron’s formula used here, and the worked demonstration of how much precision the textbook form throws away

Nothing on this page depends on data that can go stale. The relationships are the same ones Euclid set down; the sources are cited for the proofs and for the floating-point arrangement, not for the arithmetic.