Fence Calculator

Estimating fence materials involves calculating the number of posts, rails, pickets or panels, and concrete bags needed based on your fence layout. This fence calculator takes the total fence length in feet, the post spacing in feet (typically 6 to 8 feet for wood privacy fences, 8 to 10 feet for chain-link), the number of gates, and each gate's width. Posts are calculated as sections plus one for the run, plus two posts per gate. Rails are estimated at either 2 or 3 per section depending on your selection. For pickets, enter the picket width and gap to get the count per section and total. Concrete bags default to 2 bags per post for a typical 6-inch diameter hole 2 feet deep. For taller fences in difficult soils, increase to 3 bags per post. Corner posts and end posts are not separately calculated; add them to the post count manually if your fence has more than two ends. Gate posts should be treated posts rated for ground contact (typically pressure-treated to at least UC4B classification). Line posts can be standard ground-contact pressure-treated lumber. Always check local building codes, setback requirements, and HOA restrictions before installing a fence. Utility line marking (call 811 in the US) is required before any digging.

Sections--
Line posts--
Gate posts (2 per gate)--
Total posts--
Rails needed--
Pickets needed--
Concrete bags needed--

Fence calculation formula

Fence length (minus gates) = Total length - (Gates x Gate width)
Sections = ceil(Fence length / Post spacing)
Line posts = Sections + 1
Gate posts = Gates x 2
Total posts = Line posts + Gate posts
Rails = Sections x Rails per section
Pickets per section = ceil(Post spacing x 12 / (Picket width + Gap))
Total pickets = Pickets per section x Sections
Concrete bags = Total posts x Bags per post

Fence calculator: frequently asked questions

How many fence posts do I need?

The number of posts equals the number of sections plus one, plus the number of gate posts (two per gate). For a fence with 8-foot post spacing, a 100-foot fence has 100/8 = 12.5 sections, so 13 sections and 14 line posts, plus extra corner and gate posts. This calculator automatically computes posts based on the total fence length and post spacing you enter.

How deep should fence posts be set?

A common rule is to bury one-third of the post length below grade. For a 6-foot fence with 8-foot posts, bury at least 2 feet deep (ideally 2.5 feet for stability). In freeze-thaw climates, posts should extend below the frost line, which can be 3 to 4 feet deep in northern states. Check with your local building department for the frost depth in your area.

How many bags of concrete do I need per fence post?

For a standard 6-inch diameter post hole, one 50 lb bag of concrete mix typically fills a hole 6 inches in diameter and 1 foot deep. For a 2-foot-deep hole, use 2 bags per post. For an 8-inch diameter hole 2 feet deep, use 2 to 3 bags. This calculator defaults to 2 bags per post for a typical 6-foot privacy fence installation in moderate soil.

How many rails does a wood fence section need?

Most wood privacy fences use 2 rails for 4-foot-high fences and 3 rails for 6-foot-high fences. The rails span between posts horizontally, and the pickets or boards attach to the rails vertically. Some designs use 2 rails with a kick board at the bottom instead of a third rail. This calculator offers both 2-rail and 3-rail options.

Do I need a building permit to build a fence?

In most US jurisdictions, fences over a certain height (often 4 to 6 feet) require a building permit and may have setback requirements from property lines, easements, and street right-of-ways. Fences near driveways or intersections may also have height restrictions for sight-line safety. Always check with your local city or county planning and zoning department before building a fence.

Sources

  • American Wood Protection Association UC classification for treated wood: awpa.com.
  • Call 811 (US national dig-safe hotline) before any digging: call811.com.

Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology. Check local building codes before installing fences.