Math · Geometry

Law of cosines calculator.

Find a side from two sides and the angle between them, or an angle from all three sides.

SAS and SSSShows the formula usedChecked 16 October 2026

Advertisement

Inputs

Result

Enter your values.

What is the law of cosines?

The law of cosines relates the three sides of any triangle to one of its angles: c² = a² + b² − 2ab cos C. When C is 90° the cosine is zero and it collapses to the Pythagorean theorem. Rearranged, cos C = (a² + b² − c²) / 2ab, which gives an angle when all three sides are known. Use it for SAS (two sides and the included angle) and SSS (three sides); for ASA, AAS and SSA use the law of sines, which the triangle calculator applies automatically.

Worked example (SAS). With b = 8, c = 11 and the included angle A = 52°, side a is 8.7546, and the other angles are 46.0616° and 81.9384°. Worked example (SSS). Sides 7, 9 and 12 give angles 35.4309°, 48.1897° and 96.3794°.

Frequently asked questions

When do I use the law of cosines instead of the law of sines?

Use the law of cosines when you know two sides and the angle between them (SAS) or all three sides (SSS). The law of sines needs an angle and the side opposite it.

What if the angle is 90 degrees?

The cosine of 90° is 0, so c² = a² + b², the Pythagorean theorem. The law of cosines is the general form of it.

Why does my SSS input say no triangle?

The sides must satisfy the triangle inequality: every side has to be shorter than the other two combined. Sides 2, 3 and 10 cannot close up.

Does the angle have to be in degrees?

This calculator takes degrees. To convert from radians use the degrees to radians converter.

Sources

Checked

The law of cosines in both forms is from the MathWorld Law of Cosines page; the triangle inequality and the 180 degree angle sum are from the Triangle page. Runs entirely in your browser. Nothing you type is sent or stored.

Scope

Results are exact mathematics rounded for display, so they are only as good as the measurements you enter. Any length unit works as long as every value uses the same one; areas come out in that unit squared and volumes in that unit cubed. For homework, DIY layout and estimating, not a substitute for a surveyor, engineer or your teacher's required method.

Advertisement
Advertisement