Perimeter calculator
This perimeter calculator finds the distance around ten shapes: rectangle, square or rhombus, triangle, parallelogram, trapezoid, rhombus from its diagonals, circle (circumference), ellipse, circular sector and regular polygon. It draws the shape with your numbers, checks that the sides can actually form it, and shows each step.
Perimeter calculator: pick a shape
Fencing: posts, panels and rails
How to use the perimeter calculator
Select a shape, choose the unit you measured in, and enter the side lengths the drawing asks for. The perimeter calculator redraws the shape to scale with your numbers on it, gives the perimeter in your unit and in meters or feet, and lists the working under “Show the working”. It also refuses impossible inputs: three sides that break the triangle inequality, or four trapezoid sides that cannot close up, give a clear message instead of a meaningless number. For circles and sectors it shows the exact answer with π as well as the decimal value.
The second panel of the perimeter calculator does the job most people need a perimeter for: fencing. Give it a rectangular yard (or a straight run), the gate width and the post spacing, and it counts posts, panels and rails.
Perimeter calculator formulas
The perimeter is the total length of the boundary of a flat shape. For a polygon it is the sum of the sides; formulas save time when sides repeat. For a circle the perimeter is called the circumference. Every result of the perimeter calculator follows the table below.
| Shape | Perimeter formula | What you need |
|---|---|---|
| Rectangle | P = 2 × (L + W) | length and width |
| Square or rhombus | P = 4 × s | one side |
| Triangle | P = a + b + c | three sides |
| Parallelogram | P = 2 × (a + b) | two adjacent sides |
| Trapezoid | P = a + b + c + d | both bases and both legs |
| Rhombus from diagonals | P = 2 × √(d₁² + d₂²) | the two diagonals |
| Circle | C = 2πr = πd | radius or diameter |
| Ellipse | P ≈ π(a + b)(1 + 3h / (10 + √(4 − 3h))), h = ((a − b)/(a + b))² | semi-axes |
| Circular sector | P = 2r + r·θ (θ in radians) | radius and central angle |
| Regular polygon | P = n × s | number of sides and side |
OpenStax covers the rectangle and triangle formulas with practice problems in Prealgebra 2e, section 9.4.
Circumference and the perimeter of an ellipse
A circle of radius 5 cm has a circumference of 10π ≈ 31.416 cm. An ellipse is harder: its exact perimeter needs an elliptic integral, which has no formula in elementary functions. The perimeter calculator uses Ramanujan’s second approximation, listed in the Wolfram MathWorld article on the ellipse. It is exact for a circle, off by less than one part in a billion for an ellipse with semi-axes 6 and 4, and still within 0.05 % for an extremely flat one. The shortcut π(a + b) is easier to remember but gives 31.416 instead of 31.731 for that ellipse, 1 % low.
Worked examples with the perimeter calculator
Rectangle (default values). A rectangle 12 cm long and 8 cm wide has P = 2 × (12 + 8) = 40 cm, which is 0.4 m or 1.3123 ft. These are the numbers the perimeter calculator shows when the page opens.
Other shapes with their example values. Switch the shape in the perimeter calculator: a triangle with sides 5, 6 and 7 cm gives 5 + 6 + 7 = 18 cm. A parallelogram with sides 10 and 6 cm: 2 × 16 = 32 cm. A trapezoid with bases 12 and 8 cm and legs of 5 cm: 30 cm, and its height works out to √(25 − 4) = 4.583 cm. A rhombus with diagonals 10 and 6 cm: each side is √(5² + 3²) = √34 = 5.831 cm, so P = 23.324 cm. A circle of radius 5 cm: 10π = 31.416 cm. An ellipse with semi-axes 6 and 4 cm: about 31.731 cm. A 60° sector of radius 5 cm: 10 + 5π/3 = 15.236 cm. A regular hexagon with 5 cm sides: 30 cm.
Fence (second panel defaults). A 50 ft by 30 ft yard has a perimeter of 160 ft; with a 4 ft gate there are 156 ft of fence. With posts at most 8 ft apart, each 30 ft side takes 4 sections, the full 50 ft side takes 7, and the 46 ft beside the gate takes 6, so 21 panels, 22 posts (including the corners and the gate post) and 42 rails with two rails per section.
Perimeter calculator units
Perimeter is a length, so the perimeter calculator converts it with the plain length factor: 40 cm = 0.4 m, 1 ft = 12 in, 1 yd = 3 ft, 1 m = 3.2808 ft. That is the key difference from area, which uses the square of the factor. If you measure with a tape in feet and inches, convert to decimal feet with the Feet and Inches Calculator first; for other conversions the Length Converter lists every unit.
Practical uses of a perimeter calculator: fencing, trim, edging
Fencing. The perimeter calculator tells you how much fence to order; posts depend on the spacing and on corners and gates, which the second panel handles. Baseboard and crown molding. Measure the room perimeter and subtract door openings for baseboard (not for crown molding), then add 10 % for miter cuts. Garden edging and borders. A round flower bed 3 m across needs π × 3 = 9.42 m of edging. Quilts. Binding for a 50 by 60 inch quilt is 2 × (50 + 60) = 220 inches plus about 10 inches for joining. Run the perimeter calculator once per piece for irregular outlines.
Common perimeter calculator mistakes
Adding only two sides of a rectangle. L + W is half the perimeter. Entering a diagonal as a side. For a rhombus known by its diagonals, find the side with the Pythagorean theorem first. Using the height of a parallelogram. The perimeter needs the slanted side, not the height. Radius and diameter. A 10 cm diameter circle has a circumference of 31.4 cm, not 62.8 cm. Forgetting the two radii of a sector, or adding them to the arc of a full circle. Giving the answer in square units. Perimeter is in cm or ft, never cm² or ft².
Related geometry calculators
For the space inside the outline, use the Area Calculator, which covers the same shapes. If you know a triangle only by two sides and an angle, the Triangle Calculator finds the missing side first. The Circle Calculator goes from a circumference back to the radius and handles arcs and chords. For solids, see the Volume Calculator and the Surface Area Calculator. Everything is listed on the Geometry Calculators page.
Related calculators
Need the inside rather than the outline? The area calculator covers the same shapes, and the triangle calculator solves a triangle from angles.
- Area Calculator
- Circle Calculator
- Triangle Calculator
- Surface Area Calculator
- Volume Calculator
- Length Converter
- All geometry calculators
Frequently asked questions
How do you find the perimeter of a shape?
Add the lengths of all its sides. For a rectangle that is 2 × (length + width); for a circle it is the circumference 2πr. Use the same unit for every side. The perimeter calculator picks the right formula and shows the steps.
What is the difference between perimeter and area?
Perimeter is the distance around a shape and is measured in units of length (m, ft). Area is the surface inside and is measured in square units (m², ft²). A 12 by 8 cm rectangle has a perimeter of 40 cm and an area of 96 cm².
Is there an exact formula for the perimeter of an ellipse?
Not in elementary functions; it needs an elliptic integral. Ramanujan’s approximation, used by this perimeter calculator, is accurate to within 0.05 % for any ellipse and far better for ordinary shapes.
How many fence posts do I need?
For a straight run, divide the length by the post spacing, round up, and add one. For a closed rectangle, round up each side separately; the number of posts equals the number of sections, plus one when there is a gate.
How do I find the perimeter of a sector?
Add the two radii and the arc: P = 2r + r·θ with θ in radians; the perimeter calculator converts degrees for you. For r = 5 cm and θ = 60°, the arc is 5.236 cm and P = 15.236 cm.
Is this perimeter calculator free?
Yes. It runs in your browser, needs no sign-up and does not store or send the values you enter.