Math Runs locally Ready to use Built-in examples No tracking

Triangle Calculator

Enter three sides to get area, perimeter, all angles and the triangle type.

Give this tool three side lengths and more comes back than you might expect: not just the area and the perimeter, but all three interior angles recovered by the law of cosines, and a verdict on whether the triangle is right, acute or obtuse. Useful for checking a "find the area given three sides" problem, or verifying the angles of a cut before the material is committed.

The area uses Heron’s formula, √(p(p−a)(p−b)(p−c)) with p the semi-perimeter, and the angles come from the law of cosines (cos A = (b² + c² − a²) / 2bc). The three angles always sum to 180°, which is a free check on the result, and isosceles and equilateral triangles are labelled as such.

How to use

  1. Enter the three side lengths.
  2. Read the area, perimeter and semi-perimeter.
  3. Check the three interior angles and the classification (right, acute or obtuse).
  4. If the sides cannot form a triangle, read the reason rather than a result.

How it works

Heron's formula: area from three sides alone

Heron's formula solves "three sides known, find the area": compute the semi-perimeter s = (a + b + c) / 2, then area = √(s(s−a)(s−b)(s−c)). For 3-4-5, s = 6 and area = √(6 × 3 × 2 × 1) = √36 = 6, matching base×height÷2; for scalene triangles like 7-8-9 it is practically the only direct method.

Interior angles via the law of cosines

Interior angles come from the law of cosines: cos A = (b² + c² − a²) / (2bc), then take the inverse cosine. 3-4-5 yields 36.87°, 53.13° and 90°, summing to 180°. The law generalizes the Pythagorean theorem — when A is the right angle, a² = b² + c² and the formula degenerates into it automatically.

Can these three sides form a triangle?

Triangle inequality decides validity: the sum of any two sides must exceed the third (1, 1, 5 fails because 1 + 1 < 5). Equivalently, the difference of two sides must be smaller than the third. The tool rejects invalid inputs and classifies the triangle: compare the square of the longest side with the sum of squares of the other two — equal means right, smaller acute, larger obtuse.

Calculation basis: area uses Heron's formula (s = (a+b+c)/2, area = √(s(s−a)(s−b)(s−c))); interior angles come from the law of cosines, cos A = (b²+c²−a²)/(2bc); triangle validity is checked with the triangle inequality; and the type follows from comparing the square of the longest side with the sum of the squares of the other two.

Code example

JavaScript Heron's formula plus the law of cosines

function triangle(a, b, c) {
  if (a + b <= c || b + c <= a || a + c <= b) throw new Error("not a valid triangle");
  const p = (a + b + c) / 2;                       // semi-perimeter
  const area = Math.sqrt(p * (p - a) * (p - b) * (p - c));
  const ang = (x, y, z) =>
    Math.acos((y * y + z * z - x * x) / (2 * y * z)) * 180 / Math.PI;
  return { area, angles: [ang(a, b, c), ang(b, a, c), ang(c, a, b)] };
}

triangle(3, 4, 5);   // area 6, angles [90, 53.13, 36.87]

Python The same formulas in Python

import math

def triangle(a, b, c):
    assert a + b > c and b + c > a and a + c > b, "not a valid triangle"
    p = (a + b + c) / 2
    area = math.sqrt(p * (p - a) * (p - b) * (p - c))
    ang = lambda x, y, z: math.degrees(
        math.acos((y * y + z * z - x * x) / (2 * y * z)))
    return area, [ang(a, b, c), ang(b, a, c), ang(c, a, b)]

triangle(3, 4, 5)   # (6.0, [90.0, 53.13, 36.87])

FAQ

How do I get the area from three sides only?

Heron's formula: s = (a+b+c)/2, area = √(s(s−a)(s−b)(s−c)). For 3-4-5, s = 6 and area = √(6×3×2×1) = 6. If the sides can't form a triangle, the expression under the root goes zero or negative.

How are the interior angles computed?

Law of cosines: cos A = (b² + c² − a²) / (2bc), then take arccos. For 3-4-5 the angles are 36.87°, 53.13° and 90°; for 7-8-9 about 48.19°, 58.41° and 73.40° — always summing to 180°.

What condition must three sides satisfy to form a triangle?

The sum of any two sides must exceed the third (equivalently, the difference of any two is smaller than the third). 1, 1, 5 fails; 2, 3, 4 works. The tool reports invalid input rather than returning a bogus area.

How do I tell right, acute and obtuse triangles apart?

Take the longest side c and compare with a² + b²: equal means right (3-4-5), a² + b² > c² means acute (4-5-6), a² + b² < c² means obtuse (2-3-4).

Does this work for isosceles and equilateral triangles?

Yes. The equilateral area formula (√3/4)a² is a special case of Heron: side 5 gives 10.8253, matching the tool. For isosceles, just fill the equal sides into a, b and c appropriately.

How are units of length and area handled?

Keep them consistent: sides in centimeters give area in square centimeters; sides in meters give square meters. The tool does pure math and no unit conversion.

Is the side data sent anywhere?

No. The three numbers only take part in local square roots and inverse trigonometry — nothing uploaded, nothing logged. History stays in this browser, clears with one click, and disappears with an incognito window.