Education
Law of Cosines Calculator
Last updated: May 31, 2026
Written by Blake Boege
A Law of Cosines calculator is a mathematical tool that solves oblique or right triangles using the generalized Pythagorean theorem: c² = a² + b² − 2ab·cos(C). Given two sides and their included angle (SAS) or all three side lengths (SSS), it calculates the remaining side length and all unknown interior angles.
Solve oblique or right triangles using side-angle-side (SAS) or side-side-side (SSS) measurements with step-by-step math.
Quick Answer
Solve missing side lengths and angles of a triangle using the Law of Cosines. Supports SAS and SSS inputs with step-by-step math.
e.g. 8
e.g. 11
e.g. 47
Solved side c
8.0603
Angle A = 46.54°, Angle B = 86.46°
Step-by-step solution
Examples
SAS: a=8, b=11, C=47°
c ≈ 8.08, A ≈ 46.54°, B ≈ 86.46°
SSS: a=8, b=11, c=14
A ≈ 34.09°, B ≈ 50.32°, C ≈ 95.59°
How it works
How the Law of Cosines Works
The Law of Cosines relates the lengths of the sides of a triangle to the cosine of one of its angles. It is formulated as:
The Standard Formulas
c² = a² + b² − 2ab · cos(C)
Rearranged for angles: cos(C) = (a² + b² − c²) / (2ab)
To solve the other oblique triangle cases (such as ASA or AAS), check out our Law of Sines calculator or use the classic Pythagorean theorem calculator if you are working with a right triangle. You can also calculate the final space with our triangle area calculator.
Triangle Inequality Theorem
For three side lengths to form a real triangle, they must satisfy the triangle inequality: the sum of the lengths of any two sides must be strictly greater than the length of the remaining side. If this condition is not met (for example, sides 3, 4, and 8), the sides cannot connect to form a closed shape.
Related Calculators
More tools from Education
Frequently asked questions
Use the Law of Cosines when you are given either all three sides (SSS) or two sides and the included angle (SAS). Use the Law of Sines when you know an angle and its opposite side (AAS, ASA, or the ambiguous SSA case).
The standard formula is c² = a² + b² − 2ab·cos(C). It can be rewritten to solve for any side (e.g., a² = b² + c² − 2bc·cos(A)) or angle (e.g., cos(C) = (a² + b² − c²) / 2ab).
The Law of Cosines is a generalization of the Pythagorean theorem. If the angle C is 90° (a right angle), then cos(90°) = 0, and the formula simplifies exactly to c² = a² + b², which is the Pythagorean theorem.
In SSS mode, a solution is impossible if the side lengths do not satisfy the triangle inequality (the sum of any two sides must be strictly greater than the third side). If the inequality fails, no triangle can exist.
Related calculators
Education
Time to Decimal Calculator
Convert hours and minutes (HH:MM) to decimal hours and back for timesheets, payroll, or math problems.
Education
Deadline Calculator
Calculate a target deadline date by adding calendar days or business days to a starting date.
Education
Audiobook Calculator
Calculate your actual listening time and time saved when playing back audiobooks or podcasts at faster speeds (1x to 3x).