Rectangle Fence Perimeter Calculator

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.

ft
ft
ft
in
Total Perimeter
140.0 ft
Continuous fence line length to enclose the rectangle.
Fence Posts
18 posts
Length Side Spans 5 spans
Width Side Spans 4 spans
Posts = 2×length spans + 2×width spans. Corners shared.
2×4 Rail Boards
35 boards
Total Rail Length 280.0 ft (2 rails)
Boards Needed 35 (each 8 ft / 2.44 m)
Number of standard rail boards for double‑rail fence construction.
Fence Pickets
306 boards
Picket Width 5.50 in
Pickets per Span 18 per 8 ft
Total pickets (edge‑to‑edge) with user‑defined width to cover perimeter.
Corner‑to‑Corner Diagonal
50.0 ft
Sum of Squares (L²+W²) 2500 ft²
Measurement 50.0 ft diagonal
Use this diagonal to stake out perfectly square corners.
Material Planning Note
All quantities assume a continuous fence with no gates. Add 10‑15% for waste, cuts, and irregularities. Post count uses side‑by‑side interval calculation; corners are shared.

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.

InputsWhat the Calculator Measures
Length Side

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.

Width Side

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.

Post Spacing

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.

Picket Width

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.

Unit System

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.

FormulaRectangle Fence Perimeter

The total perimeter is the sum of all four sides of the rectangle. Because opposite sides are equal, the calculation reduces to:

$$P = 2(L + W)$$
  • \(P\) = total fence perimeter
  • \(L\) = length side
  • \(W\) = width side

Default example — 40 ft length, 30 ft width:

$$P = 2(40 + 30) = 140\text{ ft}$$
FormulaFence Post Count

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.

$$\text{Length spans} = \lceil L \div S \rceil$$
$$\text{Width spans} = \lceil W \div S \rceil$$
$$\text{Posts} = 2 \times \text{Length spans} + 2 \times \text{Width spans}$$
  • \(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:

$$\text{Length spans} = \lceil 40 \div 8 \rceil = 5$$
$$\text{Width spans} = \lceil 30 \div 8 \rceil = 4$$
$$\text{Posts} = 2(5) + 2(4) = 18$$

Each of the four corners is a post shared between two sides, so the formula already accounts for shared corners without double-counting.

Formula2×4 Rail Board Estimate

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.

$$\text{Total rail length} = P \times 2$$
$$\text{Rail boards} = \left\lceil \frac{\text{Total rail length}}{\text{Board length}} \right\rceil$$
  • 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:

$$\text{Total rail length} = 140 \times 2 = 280\text{ ft}$$
$$\text{Rail boards} = \lceil 280 \div 8 \rceil = 35$$
FormulaFence Picket Estimate

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.

$$\text{Picket width (ft)} = \frac{\text{Picket width (in)}}{12}$$
$$\text{Pickets} = \left\lceil \frac{P}{\text{Picket width}} \right\rceil$$

Default example — 140 ft perimeter, 5.5 in picket width:

$$5.5\text{ in} = \frac{5.5}{12} = 0.4583\text{ ft}$$
$$\text{Pickets} = \lceil 140 \div 0.4583 \rceil = 306$$

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.

FormulaCorner-to-Corner Fence Diagonal

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 = \sqrt{L^2 + W^2}$$
  • \(D\) = corner-to-corner diagonal length
  • \(L\) = length side
  • \(W\) = width side

Default example — 40 ft × 30 ft rectangle:

$$D = \sqrt{40^2 + 30^2} = \sqrt{1600 + 900} = \sqrt{2500} = 50\text{ ft}$$

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.

ExampleWorked Example — Default Inputs
Rectangle Fence Perimeter Calculator — Default Run
Inputs
Length Side 40 ft
Width Side 30 ft
Post Spacing 8 ft
Picket Width 5.5 in
Unit System US (ft, in)
Results
Total Perimeter 140.0 ft
Fence Posts 18 posts
Rail Boards 35 boards
Fence Pickets 306 boards
Diagonal 50.0 ft
LimitsAssumptions and Scope
Rectangular fence outlines only — not applicable to L-shapes, irregular polygons, or curved fence lines.
Continuous fence line with no gates or openings deducted from perimeter or material totals.
No slopes or grade changes. Results assume level ground along all sides.
Post size, corner bracing, end bracing, hardware, concrete, and fasteners are not included.
Rail board estimate is based on two horizontal rails at standard 8 ft (2.4384 m) board lengths only.
Picket count assumes edge-to-edge coverage with no reveal gap between boards.
No automatic waste factor is applied. All counts are theoretical minimums.
Local fence height, setback, permit, and property-line requirements are not included or verified.
⚠ Add 10–15% to all material quantities to account for board cuts, layout waste, damage, and site irregularities before ordering.
ReferencesReferences and Calculation Notes

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.

1

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.

2

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.

3
Local Building and Planning Department — Fence Regulations

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.

Calculation note: All material counts produced by this tool — posts, rail boards, fence pickets, and diagonal — are mathematical estimates derived from the formulas described above. They are provided for planning reference only and do not constitute engineering specifications, structural design, legal advice, or permit documentation. Verify all quantities with a qualified contractor or building professional before purchasing materials or commencing construction.