Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

Law Of Cosines Calculator

Calculate triangle area from three sides, or from two sides and the included angle in degrees. A handy helper for geometry and trig problems.

Enter the Details

units

units

   units

  deg

deg

deg


Result will appear here...


Last updated: March 23, 2026

Created by: Eon Tools Dev Team

Reviewed by: Okan Atalay



What this calculator does

This solves a triangle using the law of cosines. Give it three sides, or two sides and the angle between them, and it works out the remaining sides and angles. It is built for triangles with no right angle.

Choose the case, enter the values, and the tool solves the triangle.

Using the calculator

  1. Choose the case: SSS (three sides) or SAS (two sides and the included angle).
  2. Enter the values.
  3. Press Calculate.

The tool returns all three sides and all three angles.

The law | c² = a² + b² − 2ab × cos(C)

The law of cosines relates all three sides of a triangle to one of its angles:

c² = a² + b² − 2ab × cos(C)

Here C is the angle sitting between sides a and b, and c is the side opposite it. Rearranged, the same formula also hands you an angle when you know all three sides.

It generalises the Pythagorean theorem

Here is the elegant part. When the angle C is 90°, its cosine is 0, so the whole − 2ab × cos(C) term disappears and the formula collapses to a² + b² = c², the Pythagorean theorem itself. So the law of cosines is simply Pythagoras stretched to fit every triangle, not just right-angled ones. That extra term is a measure of how far the angle sits from square.

When to use it: SSS or SAS

Use the law of cosines for the two cases the law of sines cannot begin. The first is three sides known, SSS, where you want the angles. The second is two sides and the included angle, SAS, meaning the angle wedged between the two sides, where you want the third side. Neither case offers a matched angle-side pair to start from, which is precisely why this law is needed.

A worked example

Take three sides of 3, 4, and 5.

  1. The angle opposite the longest side, 5, is cos−1((9 + 16 − 25) ÷ 24) = cos−1(0).
  2. That is 90°, so the triangle is right-angled, with angles 36.87°, 53.13°, and 90°.

For the SAS case, two sides of 5 and 7 with a 60° angle between them give a third side of √(25 + 49 − 70 × cos(60°)) = √39, about 6.24.

Its partner, the law of sines

Once the law of cosines has cracked the opening, the law of sines is often the quicker route to the remaining angles. The two work hand in hand. For the right-angle case specifically, the Pythagorean theorem calculator is the simpler tool.

Questions people ask

What is the law of cosines?

c² = a² + b² − 2ab × cos(C), relating the three sides of a triangle to one angle.

How does it relate to the Pythagorean theorem?

When the angle is 90°, its cosine is 0 and the formula becomes a² + b² = c². It is Pythagoras generalised to any triangle.

When do I use it?

For three known sides (SSS), or two sides and the angle between them (SAS), the cases the law of sines cannot start.

What does "included angle" mean?

The angle that sits between the two known sides, rather than off to the side opposite one of them.

References

A note on the idea behind it. The law of cosines states that c² = a² + b² − 2ab × cos(C), relating the three sides to one angle. It reduces to the Pythagorean theorem when that angle is a right angle, and it solves the SSS and SAS cases. For further reading, see Law of cosines.

  1. The law of cosines, relating the three sides of a triangle to the cosine of one angle.
  2. Its reduction to the Pythagorean theorem when the included angle is 90°.


Okan Atalay

Okan Atalay is a results driven senior operations manager and a graduate of Industrial Engineering from Bilkent University. With over 22 years of experience in textile manufacturing and integrated operations, he has led large scale business process improvements and strategic planning initiatives. Currently, he serves as a top mathematics expert for a global ed tech platform, where he applies his analytical expertise to solve complex mathematical problems. At Eon Tools, he reviews converter and maths tools.