Fence Calculator

Measure the fence line once and get the whole bill of materials — posts, rails, pickets and cost.

Unit costs (optional)

Counts assume a straight run with a post at each end. Add one post per corner, allow about 10% extra pickets for waste, and enter all prices in the same currency.

How the fence material count is built

Every fence estimate comes down to four numbers, and each one falls out of the one before it. First you take the total length of the fence line and subtract the gate openings, because a gate is a hole in the fence, not a section of it. Second you divide that net run by the post spacing and round up — that gives the number of sections, or bays. Third you add one post, because a run of sections always needs a post on both ends: five sections need six posts. Fourth you add two more posts for every gate, since a gate hangs between its own dedicated hinge post and latch post.

Rails and pickets then follow directly. Rails are simply sections multiplied by the number of rails per section — two for most 4-foot picket fences, three for 6-foot privacy fences where the extra middle rail stops boards from cupping. Pickets are the net run converted to inches and divided by the repeat distance, which is the picket width plus the gap you want between boards.

Worked example: a 150-foot backyard fence

Say you are fencing 150 feet of back yard with one 4-foot walk gate, 8-foot post spacing, two rails per section, and standard 5.5-inch dog-ear pickets set with a 0.5-inch gap.

The net run is 150 - 4 = 146 feet. Divided by 8-foot spacing that is 18.25, which rounds up to 19 sections. Posts are 19 + 1 = 20 line and end posts, plus 2 gate posts, for 22 posts total. Rails are 19 x 2 = 38 rails, and since rails are sold in 8-foot lengths at this spacing you buy 38 of them with no cutting. Pickets are 146 x 12 = 1,752 inches of run divided by 6 inches of repeat (5.5 + 0.5), which is 292 pickets.

Put 2026-era US prices on it — say 8 per treated 4x4 post, $9 per 2x4 rail and $4 per picket — and the material cost lands at 22 x 18 + 38 x 9 + 292 x 4 = ,906 before concrete, fasteners, gate hardware and the cost of the gate itself. That last part is worth repeating: the calculator prices the fence, not the gate. A pre-hung wood gate kit runs $80 to $200, hinges and a latch another $30 to $60, and two bags of concrete per post adds roughly 50 across the whole job.

Same fence, tighter spacing

Switch to 6-foot spacing and the numbers move in a way worth understanding before you commit. The 146-foot net run becomes 24.33, rounding up to 25 sections, so posts go from 22 to 28 and rails from 38 to 50. Picket count does not change at all — 292 either way, because the boards cover the same linear distance regardless of how many posts hold them up. At the prices above, tightening the spacing costs about $216 extra, plus a dozen more bags of concrete and six more holes to dig. What you get is a fence that resists wind loading and warping far better, which is why 6-foot spacing is standard on tall privacy fences and on exposed sites.

Gate framing and why gates need their own posts

A gate post carries a cantilevered load that swings, slams and sags. That is why the count adds two posts per gate rather than borrowing line posts, and why serious builders oversize them: 6x6 posts instead of 4x4, set 6 to 12 inches deeper than the line posts, often with a diagonal brace or a steel anti-sag kit inside the gate frame. Leave a 1/2-inch gap on the hinge side and 3/8-inch on the latch side, so a 4-foot opening is framed at roughly 4 feet 1 inch between posts. If you are planning a double drive gate for a car, size the opening at 10 to 12 feet and treat it as two gates in the calculator.

Slopes: stepping versus racking

Ground is rarely flat, and the two standard answers change your material list differently. Stepping keeps every panel level and drops each one down at the post, producing a staircase profile along the top. It is the cleaner look for pre-built panels, but each post must be tall enough for the step, and the triangular gaps under each panel need a kickboard if you have a dog. Racking lets the rails follow the grade while the pickets stay plumb, which means attaching boards one at a time rather than hanging panels. Racking uses essentially the same picket count this calculator gives you; stepping generates offcuts, so buy 10 to 15% more.

Post depth, concrete and the parts this tool leaves out

Post depth is not part of the material count but it decides whether the fence is still standing in five years. The working rule is one third of the exposed height goes underground, plus 6 inches of gravel at the bottom of the hole for drainage — a 6-foot fence wants a 30-inch hole and 9-foot posts. Anywhere with freezing winters, the hole must also go below the frost line, which is 36 to 48 inches across much of the northern US and Canada. Concrete runs about two 50 lb bags per 4x4 post in a 10-inch hole, three to four for a 12-inch gate post hole.

Also outside the count: fasteners (roughly two to three exterior screws per picket per rail, so plan on 8 to 12 pounds of screws for a 150-foot fence), post caps, gravel, stain or sealer, and the extra post at every corner or change of direction. Layouts are rarely one straight line, so run the calculator once per straight leg and add a post per corner — a rectangular yard fenced on three sides needs two corner posts beyond what a single run predicts.

Finally, check the boring stuff before you buy: local codes commonly cap front-yard fences at 4 feet and rear fences at 6, many jurisdictions require a permit above that, and utility locate services are free and mandatory in most US states. Call 811 in the US or use LinesearchbeforeUdig in the UK several working days before you dig your first hole. A material list is easy to redo; a severed gas line is not.

Sources & further reading

Frequently asked questions

Should fence posts be 6 or 8 feet apart?

Eight feet is the standard in the US because rails and panels are sold in 8-foot lengths, so nothing gets cut. Drop to 6 feet for tall privacy fences, windy or exposed sites, heavy pickets, or sloping ground where shorter sections follow the grade more neatly. Six-foot spacing costs roughly a third more posts and concrete but produces a noticeably stiffer fence.

How deep do fence posts need to be?

The rule of thumb is one third of the post above ground goes below it, plus about 6 inches of gravel for drainage. A 6-foot fence therefore needs a post hole around 30 inches deep, which means buying 9-foot posts. In cold climates the hole must also reach below the local frost line — 36 to 48 inches across the northern US and Canada — or frost heave will lift the posts over a winter or two.

How much concrete does each fence post need?

For a typical 4x4 post in a 10-inch hole 30 inches deep, budget two 50 lb bags of fast-setting concrete mix per post. A 12-inch hole for a 6x6 or a gate post takes three to four bags. Multiply by the post count from this calculator, then add a couple of spare bags — running short in the middle of setting a line is worse than having one bag left over.

Does the calculator handle corners and slopes?

It sizes a straight run, so add one post for every corner or direction change in your layout. On a slope you can either step the panels down in level sections, which needs slightly taller posts at each step, or rack them to follow the grade, which needs pickets attached individually. Racked fences use about the same picket count; stepped fences add offcuts, so buy 10 to 15% extra.