Skip to main content

Perimeter of a Triangle Calculator

Calculate the perimeter of a triangle from its three sides, or from two sides and the angle between them using the law of cosines. Triangle inequality check, worked examples and different units accepted for each side.

Embed this widget

Customize the result, check the live preview, then copy the code.

Preview

Embed code type

Code to copy

Responsive and automatically resized by Bethemesh.

Perimeter

-

Was this tool useful?

How does this tool work?

This calculator gives the perimeter of a triangle, the sum of its three sides. If you only know two sides and the angle between them, it first finds the third side with the law of cosines. Use it for geometry exercises, but also to fence a triangular plot, edge a pointed flower bed or work out the length of lumber in a roof truss.

Three sides: P = a + b + c. Before adding, the tool checks the triangle inequality: each side must be strictly shorter than the sum of the other two. Lengths of 2, 3 and 6 cm cannot close into a triangle; in that case no result is shown rather than a misleading perimeter.

Two sides and the included angle: the third side comes from the law of cosines, c² = a² + b² − 2ab cos C. The perimeter is then a + b + c. With a 90° angle, cos C = 0 and the formula reduces to the Pythagorean theorem.

Each length can be entered in its own unit; the values are harmonized before the calculation and the result follows the unit of the first field. The angle can be given in degrees, radians or gradians and must be strictly between 0 and 180°.

Perimeter is a length, not an area. Two triangles with the same perimeter can have very different areas: for a given length of fencing, the equilateral triangle encloses the most area.

How to use this tool

  1. Choose the method

    Three sides if you know them all, otherwise Two sides + included angle.

  2. Enter the measurements

    Lengths with their units, angle in degrees, radians or gradians.

  3. Read the perimeter

    It appears as soon as the data form a valid triangle and updates as you type.

Formulas for the perimeter of a triangle

The perimeter is a sum; the law of cosines supplies the missing side.

Perimeter

P = a + b + c

The sum of the three sides.

Law of cosines

c² = a² + b² − 2ab cos C

The third side from two sides and the included angle.

Triangle inequality

c < a + b

The condition for the triangle to exist, checked against the longest side.

P
perimeter, in length units
a, b, c
side lengths
C
angle between a and b, opposite side c

Example: a = 4, b = 6, c = 7 cm, P = 17 cm.

Use cases

Geometry exercises

Check a perimeter, test the triangle inequality or apply the law of cosines from high school trigonometry.

Land and garden

Work out the fencing or edging for a triangular plot or flower bed.

Framing and carpentry

Get the total length of lumber for a triangular roof truss or frame.

Measuring without reaching every side

Find an inaccessible side from two distances and the angle measured between them.

Examples

Three sides

5 + 7 + 9 = 21 cm; 9 < 5 + 7, so the triangle exists.

Input

a = 5, b = 7, c = 9 cm

Result

P = 21 cm

Equilateral triangle

3 × 6 = 18 cm.

Input

three sides of 6 cm

Result

P = 18 cm

Two sides and the angle

c² = 25 + 49 − 2 × 5 × 7 × 0.5 = 39, so c ≈ 6.24 m and P ≈ 5 + 7 + 6.24 = 18.24 m.

Input

a = 5 m, b = 7 m, C = 60°

Result

P ≈ 18.24 m

Right angle

The law of cosines gives c = 5 m, just like Pythagoras: 3 + 4 + 5 = 12 m.

Input

a = 3 m, b = 4 m, C = 90°

Result

P = 12 m

Fencing a plot

120 m of fencing, minus the width of the gate.

Input

sides of 30, 40 and 50 m

Result

P = 120 m

Impossible triangle

6 > 2 + 3: the sides cannot meet.

Input

a = 2, b = 3, c = 6 cm

Result

no result

Tips and best practices

  • Make sure the angle you enter is the one between the two known sides.
  • If no result appears, check the triangle inequality against the longest side.
  • For an isosceles triangle, enter the same length twice.
  • Stick to a single unit when calculating by hand, or let the tool convert the fields.
  • For the area of the same triangle, use the area calculator, which also accepts three sides (Heron's formula).

Sources and references

Frequently asked questions

What is the formula for the perimeter of a triangle?

P = a + b + c: the sum of the lengths of the three sides, expressed in the same unit.

How do I find the perimeter if I only know two sides?

You need one more piece of information. With the angle between those sides, the law of cosines gives the third: c² = a² + b² − 2ab cos C. For a right triangle where you know both legs, the Pythagorean theorem is enough.

What is the triangle inequality?

In any triangle, each side is strictly shorter than the sum of the other two. If the longest side equals the sum of the other two, the points are collinear; if it is longer, the triangle cannot close.

How do I find the perimeter of an equilateral or isosceles triangle?

Equilateral: P = 3 × a. Isosceles with equal sides a and base b: P = 2a + b.

Does the perimeter tell me the area?

Not on its own: you need all three sides. Heron's formula actually uses the semi-perimeter s = P ÷ 2 to calculate the area.

Related tools

Tools similar or complementary to this one.

Similar tools