Audited 27 Jul 2026·Last updated 28 Oct 2026·5 citations·Tier 1·0 uses

Fence Calculator

Count fence posts, rails, panels or pickets, gates and concrete bags for a wood fence from run length and post spacing, then price the materials.

Fence Calculator

Fence style
Total post count
22
The number of posts to buy: one more than the bays, plus a hinge post and a latch post for each gate.
Ordinary fence run (excluding gates)
146
Fence sections / panels
19
Picket count (picket mode)
0
Rail count
38
Concrete bags
33
Estimated material cost
1,798.25

Background.

How many posts does a 150-foot fence need? Divide by an 8-foot spacing and you get 18.75, which is wrong twice over: you cannot buy three-quarters of a bay, and a row of bays always needs one more post than it has bays. Take out a 4-foot gate, round the 146 feet that remain up to 19 bays, add the extra end post and a hinge post and latch post for the gate, and the answer is 22.

That is the arithmetic this estimator does for a wood fence, and it carries it through to everything that hangs off the posts. Rails are counted bay by bay, concrete is counted post by post, and the infill depends on the style you pick. A panel fence buys one prefabricated panel per bay. A picket fence or a privacy fence buys individual boards, worked out from the board width plus the gap between boards. A post-and-rail fence buys neither — just posts, rails and concrete. Gates are subtracted from the length before any of this happens, because a gate opening is filled by the gate, not by fence.

For a given length, style moves the bill further than any other choice. On the same 150-foot run with one gate, a two-rail post-and-rail fence comes to $943.25 at the default prices, while adding 6-inch-module pickets at $3.50 each brings it to $1,965.25: the 292 pickets alone cost more than the whole rail fence.

The counts assume a single run with dedicated gate posts. Corners, slopes and where the gates fall can all shift the real numbers by a post or a bay, and the FAQs below explain when and by how much. None of it replaces checking your property line, local height and setback rules, and buried utilities before the first hole goes in.

What is fence calculator?

A fence material estimate turns a length of fence into a shopping list: posts, bays (the spaces between posts, also called sections), the rails that span each bay, the panels or boards that fill it, gates, and the concrete that sets the posts. The governing idea is the fence-post problem — a line divided into n intervals has n + 1 endpoints — applied to a run from which the gate openings have been removed. Lengths are in feet, picket width and gap in inches, and prices in dollars per item. The result is a quantity and budget for the materials you buy, not a structural design: post size, depth and footing are set by fence height, wind exposure, soil and local practice, and wood fence work in the United States is covered by ASTM F537, the specification for design, fabrication and installation of fences built of wood.

How to use this calculator.

  1. Measure the total fence line in feet, including the gate openings. For a fence that wraps around corners, see the FAQ on corners before entering one total.
  2. Enter the post spacing center to center. Eight feet is the usual choice for wood fences because it matches standard rail and panel lengths; for panels that fit between the posts, add the post's actual width to the panel width.
  3. Enter the number of gates and the width of one gate opening. Each gate is taken out of the fenced length and given its own hinge and latch posts.
  4. Choose the style: Panel for prefabricated panels, Picket or Privacy board for individual boards (give the board width and the gap in inches, gap 0 for butted boards), or Rail for a post-and-rail fence.
  5. Set rails per bay and concrete bags per post, then replace the default prices with your supplier's. Prices for items your style does not buy are ignored.

The formula.

Posts = ⌈ L ⁄ s ⌉ + 1 + 2 × G

The gate openings come off first: L = total run − G × gate width, where G is the number of gates. The bays are B = ⌈L ÷ s⌉, with s the post spacing; the ceiling bracket means any leftover length becomes a full, shorter bay. Posts are P = B + 1 + 2G: one more than the bays for the two ends of the run, plus a hinge post and a latch post for every gate.

Everything else follows from those counts. Rails are B × rails per bay, whatever the style. Panels equal B in panel style and are zero otherwise. Pickets, in picket or privacy style, are ⌈L ÷ m⌉, where the module m is the board width plus the gap, converted from inches to feet: a 5.5-inch board with a 0.5-inch gap repeats every 6 inches, so each foot of fence takes two boards. Concrete bags are ⌈P × bags per post⌉, rounded up because part bags are not sold. The cost is each count times its price, plus G gates at the gate price.

The layout model cuts two corners, and they push the post count in opposite directions. Bays are worked out on the total fenced length as if it were one continuous line, so a gate in the middle of the run, which splits it into two stretches that each round their own short bay up, can need one more bay than shown. And the two posts per gate assume the gate hangs on its own posts; if it hangs on the end posts of the adjoining fence, a straight run needs one post fewer per gate. In practice the two often cancel. A gate opening is never allowed to take up the whole run.

A worked example.

Example

A 150-foot post-and-rail fence with one 4-foot gate, posts every 8 feet and two rails per bay. The gate comes off first: 150 − 4 = 146 feet of fence. Dividing by the spacing gives 146 ÷ 8 = 18.25, which rounds up to 19 bays. Posts are 19 + 1 + 2 × 1 = 22. Rails are 19 × 2 = 38. At 1.5 bags per post the concrete is 22 × 1.5 = 33 bags, a whole number already, so no rounding is needed. A rail fence buys no panels or pickets. Pricing it: 22 posts at $14 is $308, 38 rails at $9 is $342, the gate is $120, and 33 bags at $5.25 is $173.25, for $943.25 in total. Posts and the concrete that sets them account for $481.25 of that, a little over half. Eighteen full bays use 144 feet, so the rounding is paying for a 2-foot stub at the end of the line. Spreading the 146 feet evenly across the 19 bays instead puts the posts 146 ÷ 19 ≈ 7.68 feet apart, which looks better along a straight fence and needs the same materials.

rails Per Section2
rail Price9
post Price14
total Run Ft150
number Of Gates1
post Spacing Ft8
bags Per Post1.5
gate Width Ft4
concrete Bag Price5.25
gate Price120
fence Stylerail

Frequently asked questions.

Why does the count give 22 posts for 19 bays?
Nineteen bays in a row need 20 posts, because the first bay needs a post at both ends and each bay after that adds one more. The gate adds two: a hinge post and a latch post. Gate posts carry the weight and the slamming of the gate, so they are usually heavier or better braced than the line posts, and estimating them separately keeps them from being forgotten.
Can I save a post at each gate?
Often, yes. If the gate hangs on the end post of one fence stretch and latches to the first post of the next, a straight run needs one post fewer per gate than the count shows. But where the gate falls also matters: a 146-foot fence split into two 73-foot stretches needs 10 bays on each side, 20 in all, rather than 19. With shared gate posts that layout needs 11 + 11 = 22 posts — the same total.
How should I enter a fence that goes around corners?
Corners fix post positions, so each side rounds its own bays. For a 40 by 35-foot yard, one 150-foot total gives 19 bays and 20 posts. Entered side by side, the 40-foot sides take 5 bays each and the 35-foot sides also 5, giving 20 bays; four sides of 6 posts, less the 4 shared corners, is 20 posts. Run each side separately and subtract one post per shared corner when accuracy matters.
Do I still need rails if I buy prefabricated panels?
Usually not, because most ready-made panels are built on their own rails. The calculator still counts rails in every style, two per bay by default, so in panel style set the rail price to zero unless you are adding rails yourself. On the 150-foot example that takes $342 off a panel fence priced at $1,798.25, leaving $1,456.25 for posts, panels, gate and concrete.
What post spacing should I use with 8-foot panels?
It depends on how the panels attach. If they are screwed to the face of the posts, set the spacing to the panel width, 8 feet. If they sit between the posts, the spacing is the panel width plus the actual width of one post: a nominal 4×4 is 3.5 inches, so the posts go 8 feet 3.5 inches apart, which is about 8.29 feet. Either way, measure the panels before you dig.
Why are pickets counted on 146 feet instead of 150?
Because the gate opening is filled by the gate, and the gate price is meant to cover it, boards and all. The pickets therefore run over the fenced length only: 146 feet of 6-inch module is 292 boards. If you are building the gate yourself from the same boards, add enough for its width, which at two boards per foot is 8 more for a 4-foot gate.
How do I count boards for a board-on-board or shadowbox fence?
Those styles overlap two layers of boards, which the single-layer picket formula does not model. Run the calculator in picket style with the gap you will leave between boards in one layer, then double the board count. With 5.5-inch boards and a 3-inch gap, one layer over 146 feet takes 207 boards, so the fence takes about 414, plus a few spares for splits and warped boards.
How many bags of concrete does each post need?
The 1.5-bag default is a placeholder; the real figure depends on the hole's diameter and depth, the post size and the bag size. Work it out from the hole dimensions with a post concrete calculator and enter the result. If you set posts in compacted gravel, or drive metal posts, enter zero. The bag count rounds up once over the whole fence, so a fraction left over still buys a whole bag.
Does a sloping yard change the counts?
It changes which length to measure. A stepped fence uses level panels that step down the slope, so the horizontal distance sets how many bays you need. A racked fence follows the ground, so measure along the slope; the boards are cut to the grade. On a steep slope the difference between the two lengths is enough to add a bay, so take both measurements before you buy.
What should I check before digging the post holes?
Three things the material list cannot tell you. Where the property line runs — a fence built a foot onto a neighbour's land may have to come down. What your local zoning or homeowners' association allows for height, setback and style, especially beside a street or around a pool. And where the buried cables and pipes are: in the United States, calling 811 a few days before digging gets them marked free.

How this page was produced

Published by
Quanta Calculator
Primary sources
5 cited below
Method
Posts = ⌈ L ⁄ s ⌉ + 1 + 2 × G
Published
Last verified

Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 1560 calculators remain free
  • No billing is enabled
Coming soon