0

Fence Calculator — Posts, Rails & Pickets from a Linear Run

Work out how many posts, rails and pickets a fence needs from its total linear run: pick a post spacing, account for gates as a real deduction from the run, and get a materials count that honestly includes the classic "N spaces need N+1 posts" fencepost problem.

This is a common rule of thumb, not a code requirement: taller, solid panels catch more wind and need a middle rail to resist bowing, while a short picket or split-rail fence usually manages with just a top and bottom rail. Check local codes and your specific fence panel's manufacturer guidance for the final call.

Buy Me a Coffee at ko-fi.com
Processing... 0%
Reading fence dimensions
Counting posts and rails
Done

Result

Most of this site's DIY calculators — tile, concrete, mulch — divide an area or a volume by the size of one unit. A fence doesn't work that way: a post either exists or it doesn't, so ordering fence materials is a real discrete-counting problem, and the classic trap in that kind of counting is the "fencepost problem": if you space posts every 8 ft along a 100 ft run, it's tempting to compute 100 ÷ 8 = 12.5 → 13 posts, but that's wrong. Thirteen posts create only twelve spaces, one space short of the full run. The correct count is N spaces need N+1 posts — 13 spaces (rounding 12.5 up) need 14 posts, an extra post that a naive division misses on every single fence.

Gates complicate the spacing in a different, very real way: a gate opening isn't filled with evenly spaced line posts, it's framed by exactly two posts of its own, usually set wider apart than the standard post spacing to fit a swinging or sliding gate. This calculator treats gate width as a real deduction from the total fence run before line posts are counted — effective run = total length − (gates × gate width) — so gates don't silently distort the line-post count, and then adds two dedicated gate posts per gate on top of the line-post total.

Rails scale with sections, not with total length directly: every section between two adjacent line posts needs its own set of horizontal rails, so rails = (line posts − 1) × rails per section. A shorter or open-style fence typically uses 2 rails per section (top and bottom), while a taller privacy fence commonly steps up to 3 (adding a middle rail) to resist the wider panel bowing under wind load. Gates need their own frame or rail set, separate from this line-fence total — a detail this calculator flags but doesn't try to fully model, since gate hardware varies too much by style to reduce to one formula.

For a picket-style fence, picket count follows the same per-unit spacing logic as posts: pickets = effective run ÷ (picket width + gap between pickets), rounded up. A worked example: a 100 ft fence with one 4 ft gate leaves a 96 ft effective run; at 8 ft post spacing that's 96 ÷ 8 = 12 spaces → 13 line posts, plus 2 gate posts = 15 posts total, and at 2 rails per section that's (13 − 1) × 2 = 24 rails. If you're pouring footings for those posts, the concrete calculator on this site's post-holes shape totals the concrete for however many holes you're filling. Everything is calculated locally in your browser — nothing you enter is uploaded or stored.