Math
Perimeter calculator
The perimeter is the distance all the way round a shape. Choose the shape, enter the lengths you know, and the calculator adds up the boundary, shows each step, and converts the result into metric and imperial units.
The angle between sides a and b.
Half the longest width.
Half the shortest width.
| Unit | Length |
|---|---|
| Millimetres (mm) | 26000 |
| Centimetres (cm) | 2600 |
| Metres (m) | 26 |
| Kilometres (km) | 0.026 |
| Inches (in) | 1023.62 |
| Feet (ft) | 85.3018 |
| Yards (yd) | 28.4339 |
| Miles (mi) | 0.0161557 |
Show the working, step by step
Two lengths and two widths.
P = 2(l + w) P = 2 × (8 + 5) = 2 × 13 = 26 m
Perimeter formulas
| Shape | Perimeter | Notes |
|---|---|---|
| Square | P = 4a | a = side |
| Rectangle | P = 2(l + w) | length and width |
| Triangle | P = a + b + c | third side by the law of cosines if needed |
| Circle | C = 2πr = πd | called the circumference |
| Semicircle | P = πr + 2r | curved edge plus the diameter |
| Sector | P = 2r + (θ ÷ 360) × 2πr | two radii plus the arc |
| Ellipse | P ≈ π[3(a + b) − √((3a + b)(a + 3b))] | Ramanujan's approximation |
| Trapezoid | P = a + b + c + d | two parallel sides and two legs |
| Parallelogram | P = 2(a + b) | two adjacent sides |
| Rhombus | P = 4a | or 4√((p/2)² + (q/2)²) from the diagonals |
| Regular polygon | P = ns | n sides of length s |
| Annulus | P = 2π(R + r) | both circles together |
A worked example
The calculator opens on a rectangle 8 m long and 5 m wide, say a garden to be fenced.
- Add one length and one width: 8 + 5 = 13 m.
- Double it, because opposite sides are equal: 2 × 13 = 26 m.
- In feet that is 26 ÷ 0.3048 = 85.3018 ft.
If there is a 1 m gate, you need 25 m of fence but still 26 m of perimeter. Posts go at the corners and at intervals along each side, so count them per side rather than dividing the perimeter, or the corners get counted twice.
The ellipse is the one shape without an exact formula
Every other shape here has a perimeter you can write down exactly. The ellipse does not: its perimeter is a complete elliptic integral of the second kind, which has no closed form. This calculator uses Ramanujan's first approximation from 1914. For the default ellipse with semi-axes 6 and 4 it gives 31.7309, correct to better than one part in a million. The error grows as the ellipse flattens: about 3 parts per million at 2:1, 34 per million at 3:1, 0.08% at 10:1, and at most 0.4% for an ellipse squashed flat into a line. For anything you can build or measure, that is more precise than the tape. The shortcut 2π√((a² + b²)/2) that some textbooks give is much rougher and should be avoided.
Trapezoids need all four sides
The area of a trapezoid uses the two parallel sides and the height, but the perimeter needs the two slanted legs as well, so this calculator asks for all four. As a bonus it works out the height: slide one leg across and you get a triangle with sides |a − b|, c and d, whose height is the trapezoid's height. With parallel sides 10 and 6 and legs of 5, the triangle is 4, 5, 5, the height is 4.58258 and the area is 36.6606.
Common mistakes
- Counting only two sides of a rectangle. l + w is half the perimeter.
- Using the diameter as the radius. A circle 10 cm across has circumference π × 10 = 31.4 cm, not 2π × 10.
- Forgetting the straight edges of a semicircle or sector, which are part of the boundary.
- Counting inside edges. For an L-shaped room, only the outside walls count; break the shape into rectangles for the area, not for the perimeter.
- Adding mixed units. Convert 2 m and 75 cm to 2 m + 0.75 m before adding.
Common questions
What is the difference between perimeter and area?
Perimeter is the length of the boundary, measured in ordinary length units (m, ft). Area is the flat space inside, measured in square units (m², ft²). Fencing, skirting board and edging are bought by perimeter; paint, turf and flooring by area. An 8 m × 5 m room has a perimeter of 26 m and an area of 40 m². Two shapes with the same perimeter can have very different areas: a 12 × 1 rectangle and a 7 × 6 rectangle both have perimeter 26, but areas 12 and 42.
Is there an exact formula for the perimeter of an ellipse?
Not in terms of elementary functions. The exact perimeter is an elliptic integral, which has to be computed numerically or by an infinite series. Ramanujan's 1914 approximation, P ≈ π[3(a + b) − √((3a + b)(a + 3b))], is what this calculator uses. For an ellipse with semi-axes 2 and 1 it gives 9.68842 against a true value of 9.68845, an error of about 3 parts per million.
How do I find the perimeter of a triangle when I only know two sides?
You also need the angle between them. The law of cosines then gives the third side: c² = a² + b² − 2ab cos C. With sides 5 and 6 and a 60° angle, c = √(25 + 36 − 30) = √31 = 5.56776, so the perimeter is 16.5678. For a right triangle the angle is 90° and this becomes Pythagoras. Choose “Triangle: two sides and the included angle” above.
What is the perimeter of a semicircle?
Half the circumference plus the diameter: P = πr + 2r. For r = 5 that is 15.708 + 10 = 25.708. Forgetting the straight edge (just πr) is the usual mistake. The same idea applies to a sector: the arc plus two radii.
Is circumference the same as perimeter?
Yes. Circumference is the name for the perimeter of a circle (and sometimes of an ellipse). It is 2πr, or π times the diameter, so a circle of radius 5 has circumference 31.4159. For every property of a circle from any one measurement, see the circle calculator.
Related calculators
-
Area calculator
The area of the same thirteen shapes, with conversions.
-
Rectangle and square
Sides, area, perimeter and diagonal from any two.
-
Circle calculator
Circumference, arcs and chords from any one measurement.
-
Triangle calculator
All sides, angles and centres of a triangle.