Calculate how many posts, rails, pickets, or prefab panels you need to build a fence, plus a subtotal of supplied material prices, from your fence layout and product-approved post spacing.
Fence Formula
The calculator works in three modes. Each mode starts by dividing the fence into sections and counting posts, then adds the materials specific to that mode.
S = sum(ceil(each infill run / effective span))
Posts = S + gate openings + 1 (open line); omit +1 for a closed loop
Rails = ceil(S * r * (1 + w/100))
Base pickets = sum(max(1, ceil((12 * run + g) / (p + g)))) Pickets = ceil(base pickets * (1 + w/100))
Panels = ceil(S * (1 + w/100)) Panel effective span = min(s, W)
- S = number of fence sections (always rounded up)
- L = total fence length
- G = combined width of gate openings
- s = maximum post spacing (center to center)
- r = rails per section
- p = picket or board width (inches)
- g = gap between pickets (inches)
- W = product-approved panel span between post centres
- w = waste allowance percentage
Round each straight infill run separately, ending runs at every corner and gate opening. Their sum must equal L – G. Use one connected, unbranched line or loop; disconnected fences require separate calculations. Each opening adds a post-to-post span, even when a double-leaf gate fills it. Panels use the smaller of product panel span and maximum post spacing, with one new panel per infill section and no assumed offcut reuse. Short spans require a product that permits trimming. Pickets cover nominal post-centre run lengths without deducting post widths; the stock allowance assumes fitting cuts or adjusted end gaps. Negative gaps represent overlap and must leave positive coverage. Round base materials to whole pieces before applying waste. Gate hardware, concrete, labour and tax are excluded.
Typical Post Spacing and Picket Coverage
These are illustrative product ranges, not structural or code recommendations. Use the selected product’s instructions and local requirements; nominal panel width can differ from post-centre spacing.
| Fence type | Typical max post spacing |
|---|---|
| Wood privacy or picket | 6 to 8 ft |
| Prefab vinyl or wood panels | 6 to 8 ft (verify effective span) |
| Chain link | up to 10 ft |
| Split rail | 8 to 11 ft (rail length) |
| Board | Actual width | Pitch (width + gap) |
|---|---|---|
| 1×4 picket | 3.5 in | 3.5 in |
| 1×6 picket | 5.5 in | 5.5 in |
| 1×6 with 0.5 in gap | 5.5 in | 6.0 in |
Example Problems
Example 1: Wood fence, open run. You are building a 100 ft straight wood fence with a maximum post spacing of 8 ft, 3 rails per section, 5.5 in pickets, no gap, no gate, and a 10 percent waste allowance. Sections = ceil(100 / 8) = 13. Posts = 13 + 1 = 14. Rails = ceil(13 * 3 * 1.10) = ceil(42.9) = 43. Base pickets = ceil(100 * 12 / 5.5) = 219. Pickets = ceil(219 * 1.10) = 241.
Example 2: Prefab panels, closed perimeter. You are enclosing a square 120 ft perimeter, with four 30 ft runs, an effective panel span and maximum post spacing of 8 ft, no gate and no waste. Sections = 4 * ceil(30 / 8) = 16. Posts = 16 and Panels = 16, assuming the panels can be shortened to fit. Rounding the combined perimeter would miss required corner posts.
Frequently Asked Questions
Why does an open run need one more post than a closed perimeter? A straight line of fence has two ends, and each end needs its own post, so the post count is the infill section count plus gate openings plus one. A closed perimeter loops back on itself and shares the corner and end posts, so the post count equals infill sections plus gate openings, after counting every corner as a run boundary.
How much waste should I add? Choose an allowance for the product, layout and likely losses; 10 percent is only an example, not a guarantee. It is applied after rounding base rails, pickets and panels to whole pieces. Posts and gate openings are not increased. Verify the complete site layout and any special supports separately.
How are gates handled? Subtract the combined opening width, including required hinge and latch clearances, from infill length. Enter the remaining straight runs individually. Each gate opening then adds one span to the post count; a double-leaf gate counts as one opening. A gate unit price is for the complete opening. The calculator does not include gate framing or hardware, since those depend on the gate style you choose.
