Rectangle Fence Perimeter Calculator uses P=2(L+W) to calculate fence perimeter, posts, rail boards, pickets, and corner diagonal from length, width, post spacing, and picket width. No gates included.
The Rectangle Fence Perimeter Calculator estimates the continuous fence line around a rectangular yard, field, or property and returns the materials needed to build it. Enter two side lengths, a post spacing interval, and a picket width to get the total perimeter, number of fence posts, 2×4 rail boards, fence pickets, and the corner-to-corner diagonal used to square the layout.
The fence perimeter calculator supports both US customary units (feet and inches) and metric units (metres and centimetres). Switching the unit system automatically converts all entered values so you can work in whichever standard your project requires.
The longer dimension of the rectangle in feet or metres. Together with the width, it defines the shape of the enclosed area and drives the perimeter calculation.
The shorter dimension of the rectangle in feet or metres. Length and width are treated as two distinct sides, each handled separately in the post-count calculation.
The on-centre distance between fence posts along each side. Each rectangle side is divided independently and rounded up to the nearest full span, so corners are never missed.
The face width of each vertical board in inches (US) or centimetres (metric). This value controls how many fence pickets are needed to cover the full perimeter edge-to-edge.
Choose US Customary (ft, in) or Metric (m, cm). The rectangle fence calculator converts all fields automatically when you switch, including the internal rail-board length standard.
The total perimeter is the sum of all four sides of the rectangle. Because opposite sides are equal, the calculation reduces to:
- \(P\) = total fence perimeter
- \(L\) = length side
- \(W\) = width side
Default example — 40 ft length, 30 ft width:
Posts are counted side by side, not from a single perimeter ÷ spacing division. Each rectangle side is spanned independently and rounded up with the ceiling function so that no side is left without a closing post. The four corners are shared between adjacent sides and are already included in this count.
- \(S\) = post spacing distance (on-centre)
- \(\lceil\,\cdot\,\rceil\) = ceiling function — round up to the next whole number
Default example — 40 ft × 30 ft with 8 ft post spacing:
Each of the four corners is a post shared between two sides, so the formula already accounts for shared corners without double-counting.
The tool assumes two horizontal rails running the full length of the fence — one near the top and one near the bottom — a standard configuration for most privacy and picket fences. Total rail length is therefore twice the perimeter, divided by the standard board length and rounded up.
- Board length = 8 ft in US Customary mode
- Board length = 2.4384 m in Metric mode (exact conversion of 8 ft)
Default example — 140 ft perimeter, two rails:
Pickets are estimated edge-to-edge using the user-defined picket width. In US mode the width is entered in inches and converted to feet before dividing into the perimeter. In metric mode it is entered in centimetres and converted to metres.
Default example — 140 ft perimeter, 5.5 in picket width:
This estimate assumes no gap between pickets. If you want a reveal gap, add the gap width to the picket width before using the formula — for example, a 5.5 in picket with a 0.5 in gap becomes a 6.0 in effective width per slot.
The fence diagonal is the straight-line distance across the rectangle from one corner to the opposite corner. This measurement is used to square a rectangular fence layout: if both diagonals of a staked rectangle are equal, the corners are at true 90°. The value follows the Pythagorean theorem:
- \(D\) = corner-to-corner diagonal length
- \(L\) = length side
- \(W\) = width side
Default example — 40 ft × 30 ft rectangle:
Measure both diagonals when staking out your fence. If they differ by more than a few centimetres or a fraction of an inch, adjust the corner stakes until both diagonals match.
Unit conversions in this rectangle fence calculator follow authoritative published standards. Material quantities are mathematical estimates only and do not constitute engineering, legal, or permit advice.
Source for all unit conversion factors used in this tool: feet to metres (1 ft = 0.3048 m), inches to centimetres (1 in = 2.54 cm), and the 8 ft board-length conversion to 2.4384 m. Published by the National Institute of Standards and Technology, U.S. Department of Commerce.
Supporting reference for the legal status and definitions of US customary and metric units of length used in this fence perimeter calculator. National Institute of Standards and Technology.
Fence layout, setback distances, maximum height, permit requirements, and property-line rules vary by local jurisdiction and may change over time. Before constructing any fence, consult your local building department, planning authority, or equivalent regulatory body for current requirements in your area.