Skip to content

Law of Cosines Calculator

The third side from two sides and the angle between them.

Work out Law of Cosines. The third side from two sides and the angle between them. Names the mistake everyone makes here.

Written and maintained by Mohit PatelLast checked August 4, 2026How we build these
°

Third side

3.6056

area 5.1962 · 60° between sides 3 and 4

Third side c3.60555
Area5.19615
Perimeter10.60555
Pythagorean value at 90°5

c² = a² + b² − 2ab·cos C. At exactly 90° the cosine is zero, the last term vanishes and it becomes Pythagoras — which is the easiest way to remember it and to check it. Below 90° the cosine is positive, so the third side comes out shorter than the Pythagorean value; above 90° it is negative and the side comes out longer. Use this when you have two sides and the angle between them, or all three sides and want an angle. For two sides and a non-included angle you need the law of sines, and that case can have two answers.

How the Law of Cosines Calculator works

Enter two sides and the angle between them for the third side and the area. At exactly 90° the cosine term vanishes and the formula becomes Pythagoras, which is both the easiest way to remember it and a useful check.

Also known as: cosine rule calculator · find the third side of a triangle · sas triangle calculator · c2 = a2 + b2 - 2ab cos c

Frequently asked questions

What is the law of cosines?

c² = a² + b² − 2ab·cos C, where C is the angle between sides a and b. It works for any triangle, not just right-angled ones.

How does it relate to Pythagoras?

It is Pythagoras plus a correction for the angle not being 90°. At 90° the cosine is zero, the correction disappears entirely, and c² = a² + b² is what remains.

When do I use the cosine rule rather than the sine rule?

When you have two sides and the angle between them, or all three sides and want an angle. The sine rule needs a matching side-and-opposite-angle pair, which those cases do not give you.

Why does an obtuse angle give a longer third side?

Because the cosine of an obtuse angle is negative, so −2ab·cos C becomes an addition. Opening the angle pushes the two far ends further apart, which is what the arithmetic is describing.

Put this calculator on your own site

Free to use, on any site, commercial or not. Paste this where you want it to appear. It is a plain iframe, so it works in WordPress, Squarespace, Wix, Webflow, Ghost and anything else that accepts HTML.

The one-line version
<iframe src="https://www.thecalclibrary.com/embed/law-of-cosines-calculator" width="100%" height="640" style="border:1px solid #e2e8f0;border-radius:12px" loading="lazy" title="Law of Cosines Calculator"></iframe>
<p style="font:13px/1.5 system-ui,sans-serif;margin:6px 0 0;color:#64748b">Powered by <a href="https://www.thecalclibrary.com/law-of-cosines-calculator" style="color:#64748b">Law of Cosines Calculator</a> from The Calc Library</p>

The only condition is that the credit line below the frame stays in place. That one line is what pays for the tool being free — it is how anyone else finds it.

Related calculators