What this fence calculator counts
A fence is ordered in three separate units — posts, pickets and rails — and they are not derived the same way. This calculator does the first and most important one: it turns a measured fence run (the total linear feet of fence line) plus a post spacing into a post count and the spacing you will actually set. Feed it the run and the spacing and it returns the number of posts; change either and the other line updates.
Everything downstream — pickets, rails, post-hole concrete, stain — is driven by that run and that post layout, so getting the posts right first is what keeps the rest of the order from drifting. A single miscounted post is a second trip to the yard; a miscounted batch is a fence that runs long or short at the last bay.
Posts sit on centre, not in the gap
Fence posts are almost always laid out on centre (often written “on center”): you measure from the centre of one post to the centre of the next. That centre-to-centre distance is what the calculator asks for and what its spacing dropdown defaults to. The distinction matters because a 4×4 post is about 3½ inches wide once it is dressed, so a “6-foot spacing” quoted on centre leaves a clear gap nearer 5 ft 8 in, while a true 6-foot clear gap would need a centre-to-centre distance closer to 6 ft 4 in. Confusing the two is one of the most common fence layout mistakes, and it compounds down a long run.
The post mode of this calculator always works on the on-centre reading — the one the dropdown label names. If you have paced out a clear gap instead, convert it before you type it in: on centre = clear gap + one post width.
The post-count formula
Two lines do the whole job:
posts = floor( run in inches ÷ spacing in inches ) + 1
actual spacing = run ÷ ( posts − 1 )
The run is converted to inches so it shares a unit with the spacing. Dividing and rounding down counts the whole intervals that fit end to end; the +1 turns intervals into posts, because the last post has no interval after it. Run it straight through for a 100-foot run at 8-foot (96-inch) spacing:
posts = floor( 1,200 ÷ 96 ) + 1 = floor( 12.5 ) + 1 = 12 + 1 = 13 posts
1,200 ÷ 96 is 12.5, and the leftover half-interval is dropped by the floor. That is the calculator being deliberately conservative: it never stretches the spacing past your number just to fill the run. The price is a slightly shorter last bay, and the second line reports it — 100 ÷ (13 − 1) = 8.33 feet on centre. Your posts end up a touch tighter than the 8 feet you typed, and the fence still lands on a post rather than running long.
Three worked examples
Three runs, three answers. Read the actual spacing line before you cut anything — it is the number that decides where the last post really falls.
Example 1 — a 100 ft back-yard run at 8 ft on centre
Enter 100 for the run and 96 for the spacing (8 feet in inches). The calculator returns 13 posts at an actual spacing of 8.33 feet. The half-interval it dropped makes the last bay roughly 8 inches shorter than the rest — invisible on a solid privacy fence, and it keeps the run from over-running the property line.
Example 2 — a 150 ft property line at 6 ft on centre
Enter 150 and 72 (6 feet in inches). The result is 26 posts at an actual spacing of exactly 6 ft. Here 150 × 12 = 1,800 in divides evenly by 72, so nothing is dropped: floor(25) + 1 = 26, and the actual spacing lands on the number you typed. When the run happens to be a whole multiple of the spacing, both lines agree.
Example 3 — a 240 ft pasture line at 8 ft on centre
Enter 240 and 96. The calculator returns 31 posts at an actual spacing of exactly 8 ft. 240 × 12 = 2,880 in ÷ 96 = 30 exactly, so again the spacing is true. A long agricultural run like this is where the count carries real money — 30 posts and 31 posts are different orders once you add posts, concrete and labour — and it is the divide that decides which.
| Example | Run | Spacing (on centre) | Posts | Actual spacing |
|---|---|---|---|---|
| Back-yard run | 100 ft | 8 ft (96 in) | 13 | 8.33 ft |
| Property line | 150 ft | 6 ft (72 in) | 26 | 6.00 ft |
| Pasture line | 240 ft | 8 ft (96 in) | 31 | 8.00 ft |
Corners, gates and end posts
The count above is for a straight run. Real fences turn corners and have openings, and each one changes the order:
- Every corner wants its own post, set heavier and deeper, because it resists pull from two directions at once. Count corners off your sketch and add one post each — the straight-run formula has no idea a turn is there.
- Every gate needs a heavier hinge post on each side plus the gate leaf itself. A 4 ft gate is a 4 ft break in the picket run, so subtract its width from the run you feed the calculator and then add two gate posts back.
- Both terminating ends already carry a post in the formula — that is what the +1 provides — so free-standing ends are covered. A line that dies into a building still wants a post tight to the wall for the pickets to land on.
A practical rule for a typical suburban lot: take the straight-run count, then add one post per corner, two per gate opening, and one for each end that meets a structure. That total — not the raw line count — is what you buy.
Pickets and rails follow the posts
Post count is only the frame. Picket count per section follows the section width and the board:
pickets = floor( ( section width + gap ) ÷ ( board width + gap ) )
A board-and-gap layout — the small gap that lets boards dry without cupping — is what a privacy fence uses. Run the same spacing engine with a 5½-inch picket and a 1½-inch gap across an 8-foot section and it returns 13 pickets; the calculator adds a 10% cut allowance and suggests buying 15. Close the gap to ¼ inch and the count rises to 16 per section. That is three extra boards per section on the gap alone, so the spacing you pick is worth real money on a long fence. Multiply per-section pickets by the number of sections (posts − 1) for the total.
Rails run horizontally and their count is a rule, not a formula: two rails for a 4–6 ft fence and three rails above that. A 6-foot fence with 12 sections therefore needs 24 rail pieces before waste. Rails are cut from the same stock as the pickets and are usually the first part to rot when a fence fails, which is why a pressure-treated rail on a metal bracket outlasts a nailed one by years.
Choosing a spacing — and when to tighten it
Six to eight feet on centre is the working range for a wood privacy fence built from 2×4 rails and 3½-inch posts. Wider spacing saves posts but puts more span on every rail, and rails sag first. Three situations push you toward the tight end of the range:
- Height and wind. A fence over 6 ft tall, or one on an exposed corner, sees far more wind load per post; 6 ft spacing sheds it better than 8.
- Soft or wet ground. In sandy or poorly drained soil the post footing carries the load alone, so shorter spans and deeper holes pay for themselves.
- Heavy rails and thick pickets. Cedar and thick composite boards weigh more than a thin pine slat, and the extra dead load wants the closer spacing.
On a short decorative or garden run, the opposite applies — 8 ft is fine, and the post count drops fast. The formula does not care which you choose; it just turns your choice into a count.
Where the estimate usually goes wrong
- Forgetting corners and gates. The straight-run count is the frame only. Corners and gate posts are added afterwards, and they are the posts you notice first if they are missing.
- Quoting a clear gap as on centre. The two differ by a full post width. Enter the on-centre figure or every bay drifts.
- Cutting before reading “actual spacing”. The line tells you the real, slightly-tighter bay. Mark both ends first and let the last bay take the difference.
- Leaving waste off the pickets. Cut ends, a trimmed last section and a spare board or two are normal; the 10% allowance is not padding.
- One spacing everywhere. A downhill or stepped run often reads better with tighter posts where the grade changes, even if the flat sections stay at 8 ft.
Once the post count is settled, size the post-hole concrete with the post-hole concrete calculator, price the boards with the vinyl fence calculator for a no-rot alternative, and work out the finish with the fence stain calculator.
Sources and standards
Where these figures come from
Every formula on this page is implemented from the published reference material below, and every worked example was produced by running this calculator rather than by hand. Post spacing is a design choice, so the calculator lets you set it rather than assuming one jurisdiction’s code.
- American Wood Council — Codes & Standards publications (checked 13 Oct 2026) — span tables, lumber design values and the Wood Frame Construction Manual that underlie preserved-wood post and rail sizing.
- APA — The Engineered Wood Association (checked 13 Oct 2026) — panel and treated-wood installation guidance for fence boards and rails.
- Ohio State University Extension (Ohioline) (checked 13 Oct 2026) — university extension guidance on fence construction, post embedment and treated lumber in service.
Figures, formulas and reference tables last checked: 13 October 2026.