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
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.
- 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.
- 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.
- 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.
- 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.
- 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.
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.
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.
Frequently asked questions.
Why does the count give 22 posts for 19 bays?
Can I save a post at each gate?
How should I enter a fence that goes around corners?
Do I still need rails if I buy prefabricated panels?
What post spacing should I use with 8-foot panels?
Why are pickets counted on 146 feet instead of 150?
How do I count boards for a board-on-board or shadowbox fence?
How many bags of concrete does each post need?
Does a sloping yard change the counts?
What should I check before digging the post holes?
References& sources.
- [1]ASTM International (2019). 'ASTM F537-01(2019): Standard Specification for Design, Fabrication, and Installation of Fences Constructed of Wood and Related Materials.' ASTM.
- [2]National Institute of Standards and Technology (2026). 'NIST Handbook 133, Appendix E: General Tables of Units of Measurement.' U.S. Department of Commerce.
- [3]National Institute of Standards and Technology (2008). 'Guide for the Use of the International System of Units (SI), NIST Special Publication 811.' U.S. Department of Commerce.
- [4]Bureau International des Poids et Mesures (2019). 'The International System of Units (SI Brochure), 9th edition.' BIPM.
- [5]American Wood Council (2018). 'Prescriptive Residential Wood Deck Construction Guide, DCA 6, 2015 IRC Version.' AWC.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- 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