Fencing

Recommendations

  • Setting posts in concrete keeps them from shifting over time — see how much you'll need with the Concrete Calculator.
  • Compare a gravel base or ground cover for the surrounding area with the Gravel Calculator.
  • Check local property line and permit requirements before digging post holes.

Compare Calculations

Downloads

Includes your inputs and results for this calculation, plus any additional calculations you've compared.

Calculating Fence Posts and Rails

A straight fence run needs one more post than the number of spans between posts. Enter your fence’s total length and how far apart you want the posts (a common range is 6-8 feet), and this calculator returns exactly how many posts, rail sections, and rails to buy.

The Formula

Spans=Fence LengthPost Spacing\vD{\text{Spans}} = \left\lceil \frac{\vA{\text{Fence Length}}}{\vB{\text{Post Spacing}}} \right\rceil

Rounded up, since a fence can’t use a fractional span.

Posts Needed=Spans+1\vE{\text{Posts Needed}} = \vD{\text{Spans}} + 1 — the same reason a fence line with 3 gaps between posts needs 4 posts, not 3: each interior post is shared by the span on either side of it, but the two end posts each belong to only one span.

Rail Sections=Posts Needed1\vF{\text{Rail Sections}} = \vE{\text{Posts Needed}} - 1

Total Rails Needed=Rail Sections×Rails per Section\text{Total Rails Needed} = \vF{\text{Rail Sections}} \times \vC{\text{Rails per Section}} (2 rails is common for a simple rail fence, 3 for a taller privacy fence)

Recommended Posts to Buy=Posts Needed+1\text{Recommended Posts to Buy} = \vE{\text{Posts Needed}} + 1 — a small one-post buffer for a damaged post or a miscount, the same waste-margin philosophy used elsewhere on this site, just as a fixed spare rather than a percentage since posts are large discrete units.

Worked Example

A 100 ft fence with posts every 8 ft, using 3 rails per section:

  1. Spans: 100÷8=12.5\vA{100} \div \vB{8} = 12.5, rounded up to 13\vD{13} spans.
  2. Posts needed: 13+1=14\vD{13} + 1 = \vE{14} posts.
  3. Rail sections: 141=13\vE{14} - 1 = \vF{13} sections.
  4. Total rails needed: 13×3=39\vF{13} \times \vC{3} = 39 rails.
  5. Recommended posts to buy (with a spare): 14+1=15\vE{14} + 1 = 15 posts.

Key Factors to Consider

  • A gate needs its own dedicated posts, sized for the gate’s weight, separate from this straight-run calculation. Gate posts typically need to be sturdier (often set deeper in concrete) than standard line posts, since they bear the ongoing stress of a swinging gate — plan for gate posts as an addition to, not a substitution within, this calculator’s post count.
  • Corner and end posts often need different bracing than mid-run posts. A fence that turns a corner puts lateral stress on the corner post that a straight run doesn’t — corner and end posts are commonly set with more concrete or additional bracing than interior line posts for this reason.
  • This calculator assumes a single straight run — a fence with multiple sides needs each run calculated separately. For an L-shaped or rectangular fence layout, calculate each straight segment on its own (since the corner posts are shared between two runs) rather than treating the total perimeter as one continuous span.
  • Post depth (how far into the ground each post is set) isn’t part of this calculation. This calculator estimates the number of posts and rails, not how deep to set each post — local frost line depth and fence height both affect how deep a post needs to be set for stability, a separate consideration from the material count here.

Common Mistakes

  • Forgetting the “N spans need N+1 posts” rule and simply dividing length by spacing. As covered above, this is the classic fencepost error — dividing a 100 ft fence by 8 ft spacing gives 12.5, but the fence actually needs 13 spans and therefore 14 posts, not 12 or 13.
  • Treating a multi-sided fence layout as one continuous run. As noted above, an L-shaped or rectangular fence needs each straight segment calculated on its own, since a corner post is shared between two runs — adding up the full perimeter and running it through this calculator once will overcount posts at every corner.
  • Forgetting gate posts entirely, or trying to substitute them into the line-post count. As covered above, a gate needs its own dedicated, sturdier posts sized for its weight — these are an addition to this calculator’s straight-run post count, not a replacement for two of the line posts near the gate opening.
  • Using the same post spacing for every fence material without checking the manufacturer’s spec. Post spacing of 6-8 feet is a common range, but a taller privacy fence, a heavier panel material, or a high-wind area can all call for closer spacing than a lighter, shorter fence would need.

Useful to Know

  • The “spans need one more post than gaps” logic here is the same off-by-one relationship behind a classic fencepost counting error in general — worth remembering any time you’re counting discrete items that sit between other discrete items, not just for fencing.
  • Buying the recommended one-post buffer costs little compared to a second trip to the supplier, but it’s worth checking return policies too — an unused spare post is often returnable if the project goes exactly as planned.
  • This calculator pairs naturally with the Fence Material Cost Calculator (for the total dollar cost once you know the post/rail counts) and the Concrete Calculator (for estimating the concrete needed to set each post).

Source: The Fencepost Error (N Spans Need N+1 Posts).

Frequently Asked Questions

How far apart should fence posts be?

Post spacing commonly ranges from 6 to 8 feet, depending on the fence material and height — check your specific fencing product's instructions, since taller or heavier panels may need closer spacing for adequate support.

Why does the calculator recommend one extra post?

A small buffer beyond the exact count needed is common practice — it covers a damaged post, a measurement error, or a small layout adjustment without a second trip to the supplier.

How many rails does a fence need?

Two horizontal rails per section is common for a simple rail fence, while taller privacy fences often use three for added rigidity — enter whichever matches your fence design.

Confirm Your Age

To create an account, please tell us your birth month and year.