MathsGeometry

Perimeter
calculator.

Perimeter is the distance around a shape, in the length you buy fence or trim by.

How it's worked out

For any shape with straight sides, the perimeter is the sum of those sides. The formulas are shortcuts for that sum. OpenStax lists the common ones: twice the length plus twice the width for a rectangle, four sides for a square, and all three or four sides for a triangle or a trapezoid.

P\displaystyle P=2l+2w\displaystyle {}= 2l + 2w
The shortcut for each straight-sided shape
ShapePerimeter
Rectangle2l+2w2l + 2w
Square4s4s
Trianglea+b+ca + b + c
Right triangle, two legsa+b+a2+b2a + b + \sqrt{a^2 + b^2}
Regular polygonn×sn \times s
Rhombus, from diagonals2p2+q22\sqrt{p^2 + q^2}
Parallelogram2a+2b2a + 2b
Trapezoida+b+c+da + b + c + d

A circle has no sides to add. Its perimeter has its own name, the circumference, and it equals π times the diameter.

C\displaystyle C=2πr\displaystyle {}= 2\pi r

A semicircle and a sector mix both ideas: a curved edge plus straight edges. The curved edge of a sector is its share of the full circle, given by the angle θ in degrees.

P\displaystyle P=2r+θ360×2πr\displaystyle {}= 2r + \frac{\theta}{360} \times 2\pi r

An ellipse is the hard case. Its exact perimeter is an elliptic integral, which has no formula in ordinary functions, so this tool uses Ramanujan's second approximation. With semi-axes a and b, and h = (a − b) over (a + b), it reads as below. For semi-axes of 10 and 5 it gives 48.442241, and the integral worked out numerically gives 48.442241.

P\displaystyle P≈π(a+b)(1+3h210+4−3h2)\displaystyle {}\approx \pi (a + b) \left( 1 + \frac{3h^2}{10 + \sqrt{4 - 3h^2}} \right)

Worked examples

Grace prices a fence for a back yard

A 24 by 16 foot yard has a perimeter of 80 feet. At $18 a foot, that is $1,440 before posts, gates and hardware.

Grace wants more room, so she tries doubling both sides to 48 by 32 feet. The fence doubles to 160 feet, while the yard goes from 384 to 1,536 square feet, which is four times the space for twice the fence.

Open this example in the tool

Hugo trims an arched window

The top of Hugo's window is a half circle with an 18 inch radius, and he wants trim all the way around that shape. The curved edge is half a circumference, 56.55 inches. The straight edge is the diameter, 36 inches, so the trim comes to 92.55 inches.

Taking half of a full circle's 113.1 inches and stopping there would leave him short by the whole straight edge. If that bottom edge sits on the window frame and needs no trim, the curved figure is the one he wants.

Open this example in the tool

Amara walks the boundary of a trapezoid lot

Amara's lot has parallel sides of 30 m and 18 m, and two 10 m sides. Adding the four gives 68 m of boundary.

Those four sides also fix the shape, because the legs and the difference of the bases form a triangle. That gives a height of 8 m and an area of 192 square meters. She could not get those from the perimeter alone.

Open this example in the tool

Reading your result

The same length can hold very different areas. With 40 units of fence, a 2 by 1 rectangle encloses 88.89 square units, a square 100, and a circle 127.32. The isoperimetric inequality says no shape does better than the circle: 4π times the area, over the perimeter squared, is at most 1, and it equals 1 only for a circle.

Working backward helps you plan. If you own 100 feet of edging and one side must be 30 feet, the other side is 20 feet. The backward solve keeps your other sizes and finds the one that uses up your length.

The figure is the line itself, not what it takes to build. Allow more for joints, overlaps and cuts. Gates usually come off the fence length and are priced apart. Round up to the next whole roll for edging sold in fixed lengths.

Regular shapes are quick. A hexagon with 5 foot sides is 30 feet around, and the tool also shows the distance from its center to the middle of a side, called the apothem, 4.33 feet. That figure gives the area.

Common mistakes

  • Mixing up perimeter and area. Perimeter is a length, in feet or meters. Area is the surface inside, in square units. You buy fence by one, and sod by the other.
  • Leaving out the straight edge of a semicircle. Half of the circumference is only the curve. Walking all the way around also takes you back across the diameter.
  • Mixing units. A side in feet and a side in inches cannot be added as they stand. Change them first, or use the unit picker to convert all the sizes at once.
  • Entering a radius as a diameter. A round bed 8 feet across has a 4 foot radius. Getting this wrong doubles the answer.
  • Using sides that cannot close up. Sides of 2, 3 and 9 do not make a triangle, since the two short ones must add up to more than the long one. The tool tells you when this happens.

Questions people ask

Yes, if you mean the whole way around the shape. For a diameter of 24 units, the curve is 37.7 and the straight edge is 24, so the perimeter is 61.7. Use the curve alone only when the straight edge does not count for your job.

Sources