Fence Calculator
Work out posts, rails and pickets for a fence from the run length, post spacing and picket width, with total material cost.
How to use this calculator
- 1Enter the total length of fence and the spacing you plan between posts, measured centre to centre.
- 2Set rails per section, and picket width and gap if the fence is boarded — remember a nominal 1×6 board is actually 5.5 in wide.
- 3Add prices to get a material cost, and tick "closes in a loop" if the fence returns to its starting point.
How the calculation works
sections = ⌈length ÷ spacing⌉ posts = sections + 1 (straight) or sections (loop) pickets = ⌈length × 12 ÷ (picket width + gap)⌉- sections
- Bays between adjacent posts, rounded up so the run is fully covered
- posts
- One more than sections on a straight run — both ends need a post
- picket width + gap
- The repeating pitch of the picket pattern, in inches
The posts formula is the classic "fencepost problem": a 100 ft run at 8 ft spacing has 13 sections but 14 posts, because posts sit at both ends of every section and adjacent sections share one. Counting sections instead of posts leaves you one post short at the end.
A fence that closes on itself — around a full yard, say — needs exactly as many posts as sections, because the last section shares its far post with the first.
Pickets divide by the pitch (width plus gap), not the width alone. Using width alone overestimates the count on any spaced fence, and the error grows with the gap.
Worked example
100 ft privacy fence, 8 ft spacing, solid 1×6 boards
- 1.Sections: 100 ÷ 8 = 12.5, rounded up to 13 bays (the last one is a short 4 ft bay).
- 2.Posts: a straight run needs sections + 1 = 14 posts.
- 3.Rails: 13 sections × 3 rails = 39 rails.
- 4.Pickets: with no gap, 100 ft × 12 = 1,200 in ÷ 5.5 in = 218.2, rounded up to 219 boards.
- 5.Cost: 14 × $18 + 39 × $7 + 219 × $4 = $252 + $273 + $876 = $1,401.
Result: 14 posts, 39 rails, 219 pickets — about $1,401
The fencepost problem
The single most common error in fence estimating has a name in mathematics: the fencepost problem, or off-by-one error. If you build 100 feet of fence with posts every 8 feet, you have 13 sections — but 14 posts, because every section is bounded by a post at each end and neighbouring sections share the post between them. Ordering 13 posts leaves the last bay with nothing to fasten to.
The exception is a fence that closes on itself, such as one enclosing a whole yard. There the final section shares its far post with the first section, so posts and sections are equal. This calculator asks which case applies rather than assuming, because the difference is exactly one post either way.
Choosing post spacing
Post spacing is a trade-off between cost and rigidity. Wider spacing uses fewer posts and less digging, but puts more load on each one and lets rails sag over time; closer spacing costs more up front and resists wind, leaning and sag far better.
- 6 ft spacing — the stiffer choice, common for tall privacy fences and in windy or exposed sites where a 6 ft solid panel acts like a sail.
- 8 ft spacing — the usual default for residential fencing, and convenient because rails and panels are commonly sold in 8 ft lengths.
- Wider than 8 ft — generally only for light rail fencing with no solid infill, where wind load is minimal and appearance tolerates some flex.
Why picket counts need the gap
A spaced picket fence repeats on a pitch of picket width plus gap, not picket width alone, because each board occupies its own width and then the empty space before the next one begins. A 5.5 in board with a 2.5 in gap repeats every 8 in, so a 100 ft run needs 1,200 ÷ 8 = 150 boards, not the 219 that dividing by width alone would suggest. Getting this wrong overestimates the order by nearly 50% on a typical spaced fence — an expensive mistake in the other direction from the fencepost error.
One detail worth noting: whether the final gap falls at the end of the run or gets absorbed depends on the layout, so the count here can be one out at the very end. That is well inside any sensible waste margin.
What a materials list leaves out
Posts, rails and pickets are the visible fence, but they are not the whole order. Posts need to be set about one-third of their above-ground height into the ground — a 6 ft fence generally wants 9 ft posts — and each hole needs gravel for drainage and usually concrete. Gates need their own posts (heavier than line posts, because they carry a swinging load), hinges, latches and often diagonal bracing. Then there are fasteners: screws or nails at every picket-to-rail and rail-to-post connection, which on a long fence runs into the thousands. None of that is counted here, so treat this as the lumber list rather than the full project cost.
What this assumes, and where it stops
Assumptions
- The fence runs on level ground. Sloped ground needs either stepped or racked panels, both of which change picket lengths and can change the count.
- Post spacing is measured centre to centre, which is the trade convention.
- Sections are rounded up, so the final bay is shorter than the others where the run does not divide evenly.
Limitations
- Gates are not modelled. A gate opening replaces a section but needs heavier posts and its own hardware, so subtract the opening from the run length and budget for the gate separately.
- Concrete, gravel, fasteners, post caps and stain or paint are not included.
- Corners and direction changes need a post each, which a single straight-run length does not capture — add one post per corner.
Common questions
How many posts do I need for a 100 ft fence?
At 8 ft spacing, 14 — not 13. The run divides into 13 sections, and a straight fence needs a post at both ends of every section, with adjacent sections sharing one. That gives sections + 1. Only a fence that closes in a loop needs exactly as many posts as sections.
How deep should fence posts be set?
The common rule is about one-third of the above-ground height, so a 6 ft fence wants roughly 2 ft in the ground and therefore 8–9 ft posts. In areas that freeze, posts should also go below the local frost line to stop frost heave lifting them, which can be deeper than the one-third rule requires.
Why is my picket count so different from length divided by board width?
Because spaced pickets repeat on width plus gap. A 5.5 in board with a 2.5 in gap repeats every 8 in, so you need far fewer boards than dividing by 5.5 suggests. Only a solid privacy fence with no gap divides by the board width alone.
Formula and content last reviewed on .
Results are estimates for information only, not professional advice.
Related calculators
Tools people commonly use alongside the fence calculator.