Triangle Solver – Law of Sines, Law of Cosines & Pythagoras

Solve any triangle from three known values (SSS, SAS, ASA, AAS or SSA) to find every side, angle, the area, perimeter, heights and radii.

Updated · Free · Runs in your browser

Sides —
Angles —
Area —
Perimeter —
Type —
Heights (altitudes) —
Inscribed & circumscribed circles —
    Was this calculator helpful?

    The formula

    Angles: A + B + C = 180°
    Law of sines: a/sin A = b/sin B = c/sin C = 2R
    Law of cosines: c² = a² + b² − 2ab·cos C
    Heron's formula: area = √(s(s − a)(s − b)(s − c)), where s = (a + b + c)/2
    Inradius r = area ÷ s;  circumradius R = a ÷ (2 sin A)

    Worked example

    1. Sides a = 5, b = 7, c = 9 (SSS).
    2. cos A = (7² + 9² − 5²) ÷ (2 × 7 × 9) = 105 ÷ 126 = 0.8333, so A = 33.56°.
    3. cos B = (5² + 9² − 7²) ÷ (2 × 5 × 9) = 57 ÷ 90 = 0.6333, so B = 50.70°, and C = 95.74°.
    4. s = 10.5, area = √(10.5 × 5.5 × 3.5 × 1.5) = √303.19 = 17.41.
    5. The largest angle is over 90°, so this is an obtuse scalene triangle.

    Solving a triangle

    Every triangle has three sides and three angles, and if you know three of these six values, including at least one side, you can usually find the rest. The calculator labels the sides a, b and c, with angles A, B and C opposite them. Choose the combination you know: three sides (SSS), two sides and the angle between them (SAS), two angles and the side between them (ASA), two angles and another side (AAS), or two sides and an angle that isn't between them (SSA). For a right triangle where you know the two shorter sides, choose the right-triangle option.

    The law of cosines

    The law of cosines generalises Pythagoras' theorem to any triangle: c² = a² + b² − 2ab·cos C. When C is 90°, the cosine is zero and it becomes c² = a² + b². Use it to find the third side when you know two sides and the angle between them (SAS), or rearrange it to find each angle when you know all three sides (SSS): cos C = (a² + b² − c²) ÷ 2ab. It's numerically reliable for every angle, which is why the calculator uses it for these cases.

    The law of sines and the ambiguous case

    The law of sines says each side divided by the sine of its opposite angle gives the same value, equal to the diameter of the triangle's circumscribed circle. It solves ASA and AAS triangles directly. The SSA case is tricky because the sine of an angle and of its supplement are equal, so two different triangles can sometimes fit the same information. This happens when the side opposite the known angle is shorter than the other known side but longer than the height. The calculator finds both triangles when this happens and shows the second in the notes.

    Area, heights and radii

    The area comes from Heron's formula, which needs only the three sides: area = √(s(s − a)(s − b)(s − c)), where s is half the perimeter. You could also use ½ab·sin C. Each height (altitude) is twice the area divided by the side it's drawn to. The inradius is the radius of the largest circle that fits inside the triangle, touching all three sides, and the circumradius is the radius of the circle passing through all three corners. These are useful in design, surveying and engineering problems.

    Types of triangle

    Triangles are classified by their sides and by their angles. An equilateral triangle has three equal sides and three 60° angles, an isosceles triangle has two equal sides and two equal angles, and a scalene triangle has no equal sides. By angles, a triangle is acute if every angle is under 90°, right if one is exactly 90° and obtuse if one is over 90°. A quick test with sides alone: if c is the longest side, the triangle is right when c² = a² + b², obtuse when c² is larger and acute when it's smaller.

    Practical uses

    Triangle calculations are used in roofing to find rafter lengths and roof pitch, in surveying and navigation to locate points by triangulation, in carpentry to check that corners are square with the 3-4-5 method, and in physics to resolve forces into components. For quick right-angled problems, the Pythagorean theorem calculator is simpler. For roof angles, see our roofing calculator, and for angles and lengths of polygons, the polygon calculator.

    Frequently asked questions

    How do I find the missing side of a triangle?
    With two sides and the angle between them, use the law of cosines. With two angles and a side, use the law of sines. In a right triangle, use Pythagoras: c = √(a² + b²).
    How do I find the angles of a triangle from its sides?
    Use the law of cosines rearranged: cos A = (b² + c² − a²) ÷ 2bc. Repeat for a second angle, and the third is 180° minus the other two.
    Why are there two answers for some triangles?
    When you know two sides and an angle that isn't between them (SSA), the side opposite the angle can sometimes swing to two positions, giving two valid triangles. This is called the ambiguous case.
    Can any three lengths form a triangle?
    No. Each pair of sides must add up to more than the third side. Lengths 2, 3 and 6 can't form a triangle because 2 + 3 is less than 6.
    How do I calculate the area of a triangle without the height?
    Use Heron's formula with the three sides, or ½ × a × b × sin C with two sides and the angle between them.

    ↑↓ to navigate · Enter to open