Skip to content

Triangle Calculator

Solve triangles using various methods including the Pythagorean theorem, law of sines, and law of cosines

Calculator Details

Area:6 sq unitsSee results ↓

Use when you know two sides of a right triangle

Pythagorean method only: the hypotenuse c, or leg a or b

One leg of the right triangle

Other leg of the right triangle

Your Results

Area: 6 sq units

Area

6 sq units

Scalene right triangle, perimeter 12 units

Perimeter

12 units

By angles

Right Triangle

By sides

Scalene

Compare scenarios

Save these inputs as a scenario, change them, and compare the results side by side.

Loading, available in a moment

Detailed Breakdown

Sides and angles of your triangle
VertexAngleOpposite side
A36.87° (solved)a = 3 (given)
B53.13° (solved)b = 4 (given)
C90° (solved)c = 5, hypotenuse (solved)
Total180°Perimeter 12

Area 6 square units; semiperimeter 6.

How This Calculator Works

How It's Calculated

Your triangle (PYTHAGOREAN)

c = √(a² + b²) = √(3² + 4²) = 5
Area = a × b ÷ 2 = 6
  • Pythagorean theorem (right triangles): a² + b² = c², where c is the hypotenuse.
  • Law of cosines: c² = a² + b² − 2ab·cos(C). Finds a side from two sides and the angle between them (SAS), or the angles from three sides (SSS).
  • Law of sines: a/sin(A) = b/sin(B) = c/sin(C). Finds the sides once two angles are known (ASA, AAS).
  • Heron's formula: Area = √[s(s − a)(s − b)(s − c)] with s = (a + b + c)/2.
  • Shoelace formula (from coordinates): Area = |x1(y2 − y3) + x2(y3 − y1) + x3(y1 − y2)| / 2; the sign of the sum shows whether the corners run counter-clockwise (+) or clockwise (−).

Frequently Asked Questions

What is the Pythagorean theorem and when can I use it?

The Pythagorean theorem states that in a right triangle, a² + b² = c², where c is the hypotenuse (the longest side opposite the right angle) and a and b are the other two sides. You can only use this theorem when you know you have a right triangle (one 90° angle) and you know the lengths of two sides. For example, if you have a 3-4 right triangle, the hypotenuse is √(3² + 4²) = √25 = 5. Choose "Side to find" to work out a leg instead: with a = 8 and c = 10, b = √(10² − 8²) = 6.

What does SSS, SAS, ASA, and AAS mean?

These are abbreviations for different triangle solving methods: SSS (Side-Side-Side) means you know all three side lengths; SAS (Side-Angle-Side) means you know two sides and the angle between them; ASA (Angle-Side-Angle) means you know two angles and the side between them; AAS (Angle-Angle-Side) means you know two angles and a side that is not between them. Each method uses different formulas to find the remaining measurements.

What is the law of cosines and when do I use it?

The law of cosines states c² = a² + b² - 2ab·cos(C). It's used to find a missing side when you know two sides and the included angle (SAS), or to find an angle when you know all three sides (SSS). It's a generalization of the Pythagorean theorem that works for all triangles, not just right triangles. When C = 90°, cos(C) = 0 and the formula becomes the Pythagorean theorem.

What is the law of sines and when should I use it?

The law of sines states a/sin(A) = b/sin(B) = c/sin(C), meaning the ratio of each side to the sine of its opposite angle is constant. Use it when you know two angles and any side (ASA or AAS), or when you know two sides and an angle opposite one of them. It's particularly useful for finding unknown sides or angles in non-right triangles once you have enough information.

How do I know which solving method to use?

Choose based on what information you have: If you have a right triangle with two sides, use Pythagorean. If you know all three sides, use SSS (law of cosines for angles). If you know two sides and the angle between them, use SAS (law of cosines). If you know two angles and the side between them, use ASA (law of sines). If you know two angles and any other side, use AAS (law of sines).

What is Heron's formula and how does it calculate area?

Heron's formula calculates the area of a triangle using only the side lengths: Area = √[s(s-a)(s-b)(s-c)], where s is the semiperimeter (s = (a+b+c)/2). This formula works for any triangle and is especially useful when you don't know the height. For example, a triangle with sides 3, 4, 5 has s = 6, so Area = √[6(6-3)(6-4)(6-5)] = √36 = 6 square units.

Why do the angles always add up to 180 degrees?

This is a fundamental property of Euclidean geometry: the sum of interior angles in any triangle is always exactly 180°. This rule is so important that it's used to validate calculations - if your three angles don't sum to 180°, there's an error. It also means if you know two angles, you can always find the third: C = 180° - A - B.

What is the difference between a right, acute, and obtuse triangle?

Triangles are classified by their angles: A right triangle has one 90° angle. An acute triangle has all three angles less than 90°. An obtuse triangle has one angle greater than 90°. You can also classify by sides: equilateral (all sides equal), isosceles (two sides equal), or scalene (all sides different). The calculator determines your triangle type based on the calculated angles.

Can I solve a triangle with just one side and one angle?

No, one side and one angle is not enough information to uniquely determine a triangle. You need at least three pieces of information, with at least one being a side length. Valid combinations are: three sides (SSS), two sides and the included angle (SAS), two angles and any side (ASA or AAS), or two sides of a right triangle (Pythagorean). With less information, infinitely many different triangles could match your data.

Why does SAS use the law of cosines for the angles?

With two sides and the included angle, the third side comes from the law of cosines. The calculator then uses the law of cosines again for angle A rather than the law of sines, because arcsine can only return angles up to 90°: for a = 10, b = 3 and C = 30°, angle A is really 138.54°, which the law of sines would wrongly report as 41.46°.

How precise are the results?

Sides, angles, area and perimeter are calculated in double precision and rounded to 10 significant digits; the page shows sides to 4 decimal places and angles to 2. Because each angle is rounded, the three shown can add up to 179.99° or 180.01°.

How do I find the area of a triangle from its coordinates?

Use the shoelace formula: Area = |x1(y2 − y3) + x2(y3 − y1) + x3(y1 − y2)| / 2. For corners (1, 1), (5, 2) and (3, 6): 1(2 − 6) + 5(6 − 1) + 3(1 − 2) = 18, so the area is 9. Choose “Coordinates of the three corners” and the calculator also gives the side lengths (distance formula) and angles.

What if the three points are in a straight line?

Then the shoelace sum is 0 and the points enclose no area, so they are not a triangle; the calculator says so. Listing the corners clockwise instead of counter-clockwise only flips the sign of the sum, not the area.

Solves flat (Euclidean) triangles from two sides of a right triangle, SSS, SAS, ASA or AAS, or the coordinates of the three corners (shoelace formula), with angles in degrees. Results are rounded to 10 significant digits. Not included: the ambiguous SSA case (two sides and a non-included angle), spherical triangles, radians, and units (sides are in whatever unit you use).

Triangle Calculator: Solve Any Triangle from Sides and Angles

By FindMySum · Last reviewed

A triangle calculator finds the sides, angles, area and perimeter of a triangle you only partly know. Three measurements are enough to fix a flat triangle completely, as long as at least one of them is a side: two sides of a right triangle, all three sides, two sides and the angle between them, or two angles and a side. From those, the Pythagorean theorem, the law of cosines and the law of sines recover everything else. This article explains which formula handles which case and why, works through the calculator's default 3-4-5 triangle and a general example, and covers the cases that need care.

Labelling the triangle

The calculator uses the standard convention: the sides are a, b and c, and each angle takes the capital letter of the side opposite it, so angle A faces side a. In a right triangle, C is the right angle and c is the hypotenuse, the longest side. Getting the labels right is half the job: the formulas below only work if each angle is paired with the side across from it.

Which formula for which case

You knowMethodMain formula
Two sides of a right trianglePythagoreana² + b² = c²
Three sides (SSS)Law of cosines for the anglescos A = (b² + c² − a²) ÷ 2bc
Two sides and the angle between them (SAS)Law of cosines for the third sidec² = a² + b² − 2ab cos C
Two angles and the side between them (ASA)Angle sum, then law of sinesa ÷ sin A = c ÷ sin C
Two angles and another side (AAS)Angle sum, then law of sinesb = a × sin B ÷ sin A

The law of cosines is the Pythagorean theorem with a correction term. When C is 90°, cos C is 0 and the correction disappears. When C is less than 90°, the third side is shorter than the right-angle case would give; when C is more than 90°, cos C is negative and the side is longer.

The law of sines says each side is proportional to the sine of its opposite angle. It is the natural tool once you know two angles, because the third angle is simply 180° minus the other two.

Area

For a right triangle, the area is half the product of the legs, area = ½ab. For any other triangle, the calculator uses Heron's formula, which needs only the three sides: with the semiperimeter s = (a + b + c) ÷ 2, the area is √(s(s − a)(s − b)(s − c)). Written that way, Heron's formula loses accuracy for long, thin triangles, because subtracting nearly equal numbers wipes out significant digits. The calculator uses the rearranged form published by William Kahan of the University of California, Berkeley, which sorts the sides first and stays accurate even for needle-shaped triangles.

Worked example: the calculator's defaults

The calculator opens in Pythagorean mode, solving for the hypotenuse c with legs a = 3 and b = 4.

  1. Hypotenuse. c² = 3² + 4² = 9 + 16 = 25, so c = 5.
  2. Angle A. The tangent of A is the opposite side over the adjacent side, 3 ÷ 4 = 0.75, so A = 36.86989765°.
  3. Angle B. The two acute angles of a right triangle add to 90°, so B = 90° − 36.86989765° = 53.13010235°, and C = 90°.
  4. Area. ½ × 3 × 4 = 6 square units.
  5. Perimeter. 3 + 4 + 5 = 12 units.

The calculator classifies it as a right, scalene triangle (no two sides equal). The angles are not round numbers even though the sides are whole, which is typical: whole-number sides and whole-number angles rarely go together.

A general triangle from three sides

Switch to SSS and enter sides of 7, 8 and 9.

  1. Angle A from the law of cosines: cos A = (8² + 9² − 7²) ÷ (2 × 8 × 9) = 96 ÷ 144 = 0.667, giving A = 48.1896851°.
  2. Angle B the same way: cos B = (7² + 9² − 8²) ÷ (2 × 7 × 9) = 66 ÷ 126, giving B = 58.41186449°.
  3. Angle C = 180° − A − B = 73.3984504°. All three are under 90°, so the triangle is acute.
  4. Area by Heron: s = 24 ÷ 2 = 12, and √(12 × 5 × 4 × 3) = √720 = 26.83281573 square units.
  5. Perimeter = 24 units.

As a check, the largest angle sits opposite the longest side, 9, and the smallest opposite the shortest, 7. That ordering always holds, and it is a quick way to catch a mislabelled input.

Two angles and a side

In AAS mode with a = 10, A = 40° and B = 60°, the third angle is C = 80°. The law of sines gives b = 13.47296355 and c = 15.32088886, and the area is 66.34139482 square units.

From coordinates: the shoelace formula

When you know where the corners are rather than how long the sides are, for example from a map grid or a graph, choose "Coordinates of the three corners" and enter A(x1, y1), B(x2, y2) and C(x3, y3). The area comes straight from the shoelace formula, Area = |x1(y2 − y3) + x2(y3 − y1) + x3(y1 − y2)| / 2, named for the criss-cross pattern of products when the coordinates are written in two columns. For corners (1, 1), (5, 2) and (3, 6) the sum is 1 × (2 − 6) + 5 × (6 − 1) + 3 × (1 − 2) = −4 + 25 − 3 = 18, so the area is 9 square units.

The side lengths then follow from the distance formula (a = |BC| = √20 ≈ 4.4721, b = |CA| = √29 ≈ 5.3852, c = |AB| = √17 ≈ 4.1231) and the angles from the law of cosines, exactly as in the SSS case: about 54.16°, 77.47° and 48.37°. If the sum is zero the three points lie on one line and there is no triangle.

Cases that need care

Rounding in the displayed angles. The calculator works to 10 significant digits, but if you copy rounded angles into another tool, their sum may come out at 179.99° or 180.01°. Use the unrounded values for any follow-on calculation.

Measured inputs carry error. If the sides come from a tape measure, the computed angles are only as good as the measurements. Small errors in the sides of a very flat triangle can move the largest angle a lot.

Flat geometry only. The formulas assume a plane. Over short distances that is fine for floors, roofs, ramps and survey sketches, but triangles drawn on the earth's surface over long distances need spherical trigonometry, which the calculator doesn't do.

SSA is excluded. Two sides and an angle that isn't between them can give two valid triangles, so the calculator leaves that case to you.

Using the result

For roof pitch, stair stringers and ramps, the Pythagorean mode gives the sloped length from the rise and run; the area and volume calculator handles triangles alongside other shapes, and the square footage calculator totals the rectangular rooms you add a triangular gable or bump-out to. To scale a triangle up or down while keeping its shape, multiply every side by the same factor with the ratio and proportion calculator: the angles stay the same and the area changes by the square of the factor. When a project depends on the result, measure twice and check that the computed diagonal matches the one you can measure.

More questions

Why can't I enter two sides and an angle that isn't between them?

That combination, called SSA, is the ambiguous case. Depending on the numbers, two sides and a non-included angle can fit no triangle, exactly one, or two different triangles, one with an acute angle and one with an obtuse angle in the same place. Rather than guess which one you mean, the calculator leaves SSA out. If you know whether the unknown angle is acute or obtuse, find it with the law of sines and then use SAS.

How do builders use the 3-4-5 rule to check a square corner?

They rely on the converse of the Pythagorean theorem: if the sides of a triangle satisfy a² + b² = c², the angle opposite c is exactly 90°. Measure 3 units along one wall and 4 along the other; if the diagonal between the marks is exactly 5, the corner is square. Multiples such as 6-8-10 or 9-12-15 (in feet or metres) give better accuracy on large layouts like decks and foundations.

What units are the area and perimeter in?

Whatever unit you used for the sides. If you enter sides in metres, the perimeter is in metres and the area in square metres; in inches, the area is in square inches. Angles are always in degrees. Don't mix units: convert every side to the same unit before entering them, or the results will be meaningless.

Why does SSS mode reject some sets of side lengths?

Three lengths only form a triangle if each is shorter than the other two added together, a rule called the triangle inequality. Sides of 2, 3 and 6 fail because 2 + 3 is less than 6: the two short sides can't reach each other. Sides of 2, 3 and 5 also fail, because they would lie flat in a straight line with zero area.

How do I find the height of a triangle from the results?

Rearrange the area formula. Since area = ½ × base × height, the height to any side is twice the area divided by that side. For the 3-4-5 default, the height to the hypotenuse is 2 × 6 ÷ 5 = 2.4 units. You can pick any side as the base; each has its own height, and all three give the same area.

What is a Pythagorean triple?

A set of three whole numbers that satisfy a² + b² = c², so they are the sides of a right triangle with no decimals. The best known are 3-4-5, 5-12-13, 8-15-17 and 7-24-25. Any multiple of a triple is also a triple, which is why 6-8-10 works. The calculator returns whole-number sides for these and a decimal hypotenuse for most other pairs of legs.

Does the order of the corners matter for the shoelace formula?

Only for the sign. Going around the triangle counter-clockwise gives a positive sum and clockwise a negative one; the area is the absolute value halved either way, and the calculator reports which way you went.

Sources

This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.

Spotted a wrong result or a bug? Report a problem

May we count your visits with Invoker Analytics? It keeps a random visitor number in your browser. Your calculator inputs are never sent. Privacy policy