Law of Cosines Calculator

This calculator applies the law of cosines to find the unknown side and all angles of a triangle when you know two sides and the included angle between them (the SAS configuration). The law of cosines states that c squared equals a squared plus b squared minus 2ab times cos(C), where a and b are the two known sides and C is the angle between them. This formula is a direct generalisation of the Pythagorean theorem and works for any triangle, acute, obtuse or right-angled. When C is exactly 90 degrees, cos(C) equals zero and the formula reduces to the familiar a squared plus b squared equals c squared. Once side c is found, the remaining angles can be obtained by applying the law of cosines again in rearranged form: cos(A) equals (b squared plus c squared minus a squared) divided by (2bc), and similarly for B. This calculator does all of that in one step. You enter side a, side b and angle C in degrees, and it returns side c, all three angles and the area of the triangle using the formula half times a times b times sin(C). Input values must all be positive and the angle C must be strictly between 0 and 180 degrees. The tool is useful for students working on NCEA geometry, engineers calculating diagonal dimensions across a known angle, and surveyors working with triangulated field measurements. For a triangle where two angles and a side are known, use the Law of Sines Calculator instead. Results are rounded to two decimal places; treat them as accurate for planning and checking purposes.

Conservation Amendment Bill
°
6.24
side c (opposite C)
Angle A44.42°
Angle B75.58°
Angle C60.00°
Area15.19

SAS mode: enter two sides and the included angle. All sides must be positive and angle C must be between 0 and 180 degrees.

How it works

Step 1: c = sqrt(a² + b² − 2ab × cos(C)). Step 2: A = arccos((b² + c² − a²) / (2bc)). Step 3: B = 180 − A − C. Area = (1/2) × a × b × sin(C). All angles are converted to radians before passing to Math.cos and Math.sin. The arccos (Math.acos) result is converted back to degrees by multiplying by 180 / pi. If any value is undefined or non-finite the calculator shows an error.

Worked example

Enter a = 5, b = 7, C = 60 degrees. c = sqrt(25 + 49 − 2 × 5 × 7 × cos(60)) = sqrt(74 − 35) = sqrt(39) = 6.24. Angle A = arccos((49 + 39 − 25) / (2 × 7 × 6.24)) = arccos(63 / 87.38) = arccos(0.7210) = 44.42 degrees. Angle B = 180 − 44.42 − 60 = 75.58 degrees. Area = 0.5 × 5 × 7 × sin(60) = 0.5 × 35 × 0.8660 = 15.19. These match the default values pre-filled above.

Related calculators

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-06-25 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.