Home / Math / Geometry / Triangle Calculator
Math calculator

Triangle Calculator

Solve triangles from three sides, two sides and an included angle, two right-triangle legs, or base and height.

Calculator

Use the same linear unit for every length. Area is returned in the corresponding square unit.

Enter your values and select Calculate.

Triangle Results

Review the solved sides, angles, area, perimeter, altitudes, and circle radii.

Side Length Comparison

Calculation Details

MeasurementValueCalculation note

How to solve a triangle

A triangle is determined only when enough independent measurements are known. Choose three sides (SSS), two sides and their included angle (SAS), two perpendicular legs for a right triangle, or base and perpendicular height when you only need area. The calculator returns the measurements that can be uniquely derived from that choice instead of inventing missing information.

Three-side (SSS) triangle calculator

Enter side lengths a, b, and c. Each side must be positive, and any two sides must add to more than the third. This is the triangle inequality. For example, 1, 2, and 3 do not form a triangle because the two shorter lengths meet in a straight line rather than enclosing an area.

For a valid SSS triangle, the semiperimeter is half the perimeter. Heron's formula then finds area without requiring a height.

s = (a + b + c) / 2
area = sqrt(s(s - a)(s - b)(s - c))

The three angles are calculated with the law of cosines. Angle A is opposite side a, angle B is opposite side b, and angle C is opposite side c.

Two sides and included angle (SAS)

Use SAS when the known angle lies between the two known sides. The law of cosines finds the third side, and one-half times the two known sides times the sine of the included angle gives the area.

c = sqrt(a² + b² - 2ab cos(C))
area = ab sin(C) / 2

The angle must be greater than 0 degrees and less than 180 degrees. A zero-degree or 180-degree angle collapses the figure into a line.

Right triangle calculator

When the two legs meet at 90 degrees, the Pythagorean theorem finds the hypotenuse. The calculator also returns both acute angles, area, perimeter, altitudes, inradius, and circumradius.

c = sqrt(a² + b²)
area = ab / 2

Base and height area calculator

Enter a base and the perpendicular height measured from that base to the opposite vertex. This mode calculates area only. Base and height do not uniquely determine the other two sides, the three angles, or the perimeter because the top vertex can move parallel to the base while preserving the same height and area.

area = base x perpendicular height / 2

People sometimes search for the “surface area of a triangle,” but a flat triangle has an area. Surface area normally describes the total exposed area of a three-dimensional solid.

Worked 3-4-5 triangle example

For sides 3, 4, and 5, the semiperimeter is 6. Heron's formula gives sqrt(6 x 3 x 2 x 1) = 6 square units. The perimeter is 12 units. The angles are approximately 36.8699 degrees, 53.1301 degrees, and 90 degrees, confirming that this is a right triangle.

Altitudes, inradius, and circumradius

Once all three sides and area K are known, each altitude follows from rearranging the base-height area formula: h-a = 2K/a, h-b = 2K/b, and h-c = 2K/c. The inradius is the radius of the circle tangent to all three sides, while the circumradius belongs to the circle passing through all three vertices.

inradius r = K / s
circumradius R = abc / (4K)

Formula source and calculation method

The calculator follows the law of cosines and Heron's formula summarized in the OpenStax Precalculus 2e key equations. It keeps full JavaScript floating-point precision during intermediate steps and rounds only displayed results. Near-degenerate triangles can be sensitive to small input changes, so retain appropriate measurement precision.

Frequently asked questions

Can three side lengths always make a triangle?

No. All sides must be positive and the sum of any two sides must be greater than the remaining side.

What units should I use?

Use one consistent unit for every length. If sides are in feet, perimeter and radii are in feet and area is in square feet. The same logic applies to inches, meters, centimeters, or any other unit.

Why does base and height mode not show perimeter?

Many different triangles can share the same base and perpendicular height. More information is required to determine the sloping sides and perimeter.

Which angle is C in SAS mode?

Angle C is the included angle between sides a and b. The calculated side c lies opposite angle C.

Related calculators