Fence Calculator
Plan a wood fence from one measurement. Enter your fence length and height, and get the posts, pickets, rails, and bags of concrete you need, with gates and cost included.
A fence calculator turns a single number, the total length of fence you are building, into a complete materials list: posts, pickets, rails, and the concrete to set the posts. It exists because a fence is more arithmetic than it looks, with post spacing, gate openings, picket gaps, and rail counts all feeding off each other, and a wrong guess on any one means a second trip to the lumberyard.
This calculator is built for wood fences, the picket and privacy styles most homeowners build. Enter the run length, pick a height, and note any gates, and it returns the full count. The advanced section opens up everything an estimator wants to control: post spacing, picket width and gap, rails per section, and the post-hole size that drives the concrete. Cost is a simple per-linear-foot input, the way fencing is usually priced.
A fence calculator turns a single number, the total length of fence you are building, into a complete materials list: posts, pickets, rails, and the concrete to set the posts. It exists because a fence is more arithmetic than it looks, with post spacing, gate openings, picket gaps, and rail counts all feeding off each other, and a wrong guess on any one means a second trip to the lumberyard.
This calculator is built for wood fences, the picket and privacy styles most homeowners build. Enter the run length, pick a height, and note any gates, and it returns the full count. The advanced section opens up everything an estimator wants to control: post spacing, picket width and gap, rails per section, and the post-hole size that drives the concrete. Cost is a simple per-linear-foot input, the way fencing is usually priced.
How to Use This Calculator
Step 1: Measure the total run
Walk the fence line and add up every straight section to get the total length. For a perimeter, stake the corners and measure side to side. A measuring wheel beats a tape for long distances. Enter the total in feet or meters.
Step 2: Choose the height
Pick your fence height from the dropdown. Height sets the rail count automatically (one rail per 24 inches), so a 6 foot fence gets 3 rails per section and a 4 foot fence gets 2. Check your local limit first, since many areas cap back yards around 6 feet and front yards lower.
Step 3: Count the gates
Enter how many gates the fence has. Each gate opening is removed from the picketed run and adds a post, since gates hang on dedicated posts. Set the gate width in the advanced section if yours is not the 4 foot default (a single walk gate is often 3 to 4 feet, a drive gate much wider).
Step 4: Refine in advanced (optional)
Open advanced options to match your real materials: post spacing (6 feet for a stiffer fence, 8 feet to save posts), picket width and gap (set the gap to zero for a solid privacy fence), rails per section, and the post size and hole depth that drive the concrete. Set hole depth to clear your frost line.
Step 5: Add cost (optional)
Enter a price per linear foot for a budget figure. This works with either a material-only rate or an installed rate from a contractor quote.
Reading the results
The cards show posts and pickets, with rails and concrete bags listed below them. The copy button captures the whole materials list. Remember to add gate hardware, post caps, and fasteners, which are not part of these counts.
How the Calculation Works
The estimate builds the fence in five linked steps, all driven off the run length.
Step 1: The picketed run
Picketed run = Fence length - (gates × gate width)
Gate openings do not get pickets or rails, so they come out of the run first. A 100 foot fence with one 4 foot gate has a 96 foot picketed run.
Step 2: Sections and posts
Sections = round up (Picketed run / post spacing)
Posts = Sections + 1 + number of gates
At 8 foot spacing, 96 feet is 12 sections. The posts are the sections plus one (every run of sections needs one more post than the gaps between them), plus one extra sturdy post for each gate. That is 12 + 1 + 1 = 14 posts.
Step 3: Rails
Rails = Sections × rails per section
The trade rule is one rail for every 24 inches of fence height, with a minimum of two. A 6 foot (72 inch) fence uses 3 rails per section, so 12 × 3 = 36 rails. You can set this manually for shadowbox or unusual designs.
Step 4: Pickets
Pickets = round up (Picketed run in inches / (picket width + gap))
Each picket occupies its own width plus the gap beside it. For a privacy fence the gap is zero, so the boards sit edge to edge. With 5.5 inch boards and a 2 inch gap, a 96 foot run (1,152 inches) needs 1,152 / 7.5 = 154 pickets.
Step 5: Concrete for the posts
Per hole = (hole volume - buried post volume), summed over all posts and divided into bags.
The hole diameter is taken as three times the post width, the standard rule, and the buried post displaces some of that volume. A 4×4 post in a 2 foot deep hole takes about 1 cubic foot of concrete, which is just over two 60 pound bags. Fourteen posts come to about 33 bags.
Cost (optional): Cost = Fence length × price per linear foot, the way fencing is normally quoted, whether for materials alone or installed.
Worked Example
Scenario: A 150 foot cedar privacy fence with one gate
You are enclosing a back yard with 150 feet of 6 foot cedar privacy fence, one 4 foot walk gate, posts every 8 feet, solid boards (5.5 inch pickets, no gap), 4×4 posts in 2 foot holes, and 60 pound concrete bags. Installed cedar is running about $25 per linear foot.
Step 1: Picketed run
150 – (1 × 4) = 146 feet (1,752 inches)
Step 2: Sections and posts
Sections = 146 / 8 = 18.25, rounded up to 19 sections
Posts = 19 + 1 + 1 = 21 posts
Step 3: Rails
6 foot fence = 3 rails per section, so 19 × 3 = 57 rails
Step 4: Pickets
Solid boards, no gap: 1,752 / 5.5 = 318.5, rounded up to 319 pickets
Step 5: Concrete
A 4×4 in a 2 foot hole takes about 1.03 cubic feet. Across 21 posts that is about 21.7 cubic feet, which is 49 bags of 60 pound concrete (about 2.3 bags per post).
Step 6: Cost
150 × $25 = about $3,750
Final list: 21 posts, 319 pickets, 57 rails, and 49 bags of concrete, roughly $3,750 installed. Then add the gate kit (hinges and latch), 21 post caps, and exterior screws, none of which come out of these counts. Switching to 80 pound bags would cut the concrete to about 37 bags, and tightening post spacing to 6 feet would add posts, rails, and concrete while making the fence noticeably stiffer.
Understanding the Variables
Fence Length
The total run of fence, the sum of every straight section around the layout. This is the single most important input, since posts, rails, and pickets all scale from it. Measure the actual ground line, and for sloped yards measure along the slope rather than the horizontal, since the fence follows the grade.
Fence Height
How tall the fence stands above ground, which sets the rail count (one rail per 24 inches, minimum two) and influences post size and hole depth. Common heights are 3 to 4 feet for front-yard and decorative fences and 6 feet for back-yard privacy. Local zoning usually limits height, so confirm before building.
Gates
The number of gate openings. Each gate is removed from the picketed run (gates do not get pickets or rails) and adds one post, because a gate needs solid, dedicated hinge and latch posts. A typical yard has one or two gates.
Post Spacing (advanced)
The on-center distance between posts, normally 6 or 8 feet. Eight feet uses fewer posts and less concrete; six feet costs more but resists sagging and wind better, and is the safer choice for tall privacy fences or windy sites. Going beyond 8 feet is not recommended, as rails begin to sag.
Picket Width and Gap (advanced)
The face width of each board and the space beside it. A nominal 1×6 board is actually 5.5 inches wide, which is why that is the default. Set the gap to zero for a solid privacy fence, or 1.5 to 2 inches for a spaced picket look. The gap strongly affects the picket count: doubling it roughly cuts the boards needed.
Rails per Section (advanced)
The horizontal boards spanning each section, which the pickets attach to. Auto follows the one-per-24-inches rule, giving 2 rails up to 4 feet and 3 rails at 6 feet. Override it for shadowbox fences or local requirements; some jurisdictions specify a third rail on taller fences regardless of the rule.
Post Size, Hole Depth, and Bag Size (advanced)
These three drive the concrete estimate. The hole is dug to about three times the post width, and the buried post displaces part of it. Deeper holes and larger posts need more concrete. Set the depth to reach below your frost line, often 2 feet or more in cold climates, and pick your bag size: an 80 pound bag yields about a third more than a 60 pound bag.
Fence Cost
Price per linear foot, the standard way fencing is quoted. As rough installed ranges, wood privacy fencing commonly runs about $15 to $40 per foot and vinyl higher, varying widely by material, height, and region. Optional input, affects only the cost figure.
Industry Standards & References
Call before you dig (811)
Before any post hole is dug, federal and state programs require contacting the 811 one-call service to mark buried utilities. It is free, it is the law in most jurisdictions, and hitting a gas or electric line is both dangerous and expensive. Place the call several business days ahead of digging.
Local zoning and permit codes
Fence height, setback from property lines, and corner-visibility rules are governed by municipal zoning, not a national code, and they vary widely. Many areas cap back-yard fences around 6 feet and front-yard fences lower, require permits above a certain height, and set sight-triangle limits near driveways and corners. Always check locally and confirm the property line before building.
Frost-depth footings (IRC R403)
The International Residential Code requires footings to bear below the local frost line so freeze-thaw cycles cannot heave them. Frost depth ranges from near zero in the far south to 4 feet or more in northern states. Setting fence posts to this depth is what keeps a fence plumb through winters.
AWPA U1 (Pressure-Treated Wood)
The American Wood Protection Association’s U1 standard defines the preservative retention levels for treated lumber by use category. Posts set in or near the ground require ground-contact rated material (a higher retention than above-ground lumber), which is the grade to specify for anything touching soil or concrete.
Pool barrier requirements (IRC Appendix and ISPSC)
If the fence serves as a swimming pool barrier, stricter safety rules apply: typically a minimum 48 inch height, no gaps a small child could pass through, limited spacing on picket fences, and self-closing, self-latching gates that swing away from the pool. These requirements override ordinary fence preferences where a pool is involved.
Good practice for longevity: set posts in concrete that crowns above grade so water sheds away from the wood, leave a 1 to 2 inch gap between the pickets and the ground to slow rot, and use exterior-rated (hot-dipped galvanized or stainless) fasteners, since standard screws corrode and stain the wood.
Frequently Asked Questions
Divide your fence length by the post spacing and round up to get the number of sections, then add one for the end post plus one for each gate. A 100 foot fence at 8 foot spacing with one gate needs 14 posts. The calculator above does this automatically and also handles the gate openings.
Six to eight feet on center is standard. Eight feet uses fewer posts and less concrete and suits most fences; six feet costs more but resists sagging and wind better, making it the safer choice for tall privacy fences or exposed, windy sites. Spacing wider than 8 feet lets the rails sag over time.
Convert the fence length to inches and divide by the picket width plus the gap, then round up. A 96 foot run of 5.5 inch boards with a 2 inch gap needs 154 pickets; the same run with no gap (a solid privacy fence) needs about 210. Set your picket width and gap in the calculator's advanced section.
A 4x4 post in a 2 foot deep hole takes about 1 cubic foot of concrete, which is just over two 60 pound bags or roughly one and a half 80 pound bags. Larger 6x6 posts and deeper holes need more. The calculator totals the bags for every post hole based on your post size and hole depth.
Deep enough to clear your local frost line and to bury about a third of the post, commonly 2 feet for a 6 foot fence, and deeper in cold climates where frost can reach 3 to 4 feet. Setting posts below the frost line is what stops winter heaving from pushing them up and out of plumb.
The rule is one horizontal rail for every 24 inches of height, with a minimum of two. A 4 foot fence uses 2 rails per section and a 6 foot fence uses 3. Taller privacy fences sometimes get an extra rail for stiffness, and the calculator lets you set the number manually.
Wood costs less upfront and offers a natural look and easy customization but needs regular staining and repairs; vinyl costs more initially but lasts longer with almost no maintenance. The right call depends on your budget horizon and how much upkeep you want. Our wood fence vs vinyl fence guide compares cost, lifespan, and maintenance in detail.
Often yes, depending on height and location. Many municipalities require a permit above a certain height and enforce setback and corner-visibility rules, and these vary by town. Confirm the property line, check local zoning, and call 811 to mark utilities before you dig, regardless of whether a permit is required.
