How to use the fence calculator
- Measure the total length of the fence line in feet. For a fence around a yard, measure each side and add them up.
- Enter the number of gates and the width of each opening.
- Enter your post spacing, the distance from the center of one post to the next, and how many rails each section has.
- Enter the actual picket width and the gap you want between pickets (0 for a solid privacy fence).
- Optionally tick Estimate material cost and enter prices from your supplier.
Fence material formulas
Fence run = total length − (gates × gate width) Sections = fence run ÷ post spacing, rounded up Posts = sections + 1 + number of gates Rails = sections × rails per section Pickets = fence run (in inches) ÷ (picket width + gap), rounded up
Why the “+ 1”? A straight run of fence always has one more post than sections, like the gaps between fingers. Each gate breaks the run, so it adds one more post to frame the opening.
Worked example: a 120 ft fence with one gate
Total length 120 ft, one 4 ft gate, posts every 8 ft, 2 rails per section, 5.5-inch pickets with 0.5-inch gaps.
- Fence run: 120 − 4 = 116 ft
- Sections: 116 ÷ 8 = 14.5, round up to 15
- Posts: 15 + 1 + 1 = 17
- Rails: 15 × 2 = 30
- Pickets: 116 × 12 = 1,392 in ÷ 6 in = 232
With a third rail per section, you would need 45 rails instead. For a privacy fence with no gaps, the same run needs 1,392 ÷ 5.5 ≈ 254 pickets.
Measuring your fence line
- Confirm the property line before measuring. A survey or your local records office can help, and building just inside the line avoids disputes.
- Measure each straight side separately. For best accuracy with corners, run the calculator for each side, add the results, and subtract one post per corner (two sides share the corner post).
- Mark gate positions early. Gates are usually placed where people actually walk, and they need sturdy posts on both sides.
- Note slopes. On a hill, measure along the ground. Stepped fences may need extra posts or longer pickets.
Choosing post spacing
Post spacing affects strength, appearance and cost. Closer posts mean a stronger fence but more posts and holes; wider spacing saves material but can let rails sag. Many wood fences are built with posts 6 to 8 ft apart, often matching the length of the rails or panels being used. Vinyl and metal panel systems usually specify an exact spacing. Always follow the manufacturer’s instructions, and allow for local wind exposure and any building code requirements.
Pickets, rails and actual sizes
Lumber is sold by “nominal” size, which is larger than the real dimensions. A board sold as 1×6 is typically about 5.5 inches wide, which is why the calculator’s default picket width is 5.5 inches. Measure a board if you aren’t sure. Buy a few extra pickets and rails for cuts, mistakes and boards with knots or splits.
Other things to plan for
- Post setting: concrete, gravel or post anchors, depending on the fence and your soil. Check the bag or product label for how much each post needs.
- Hardware: screws or nails, rail brackets, gate hinges and latches.
- Finish: stain or sealer for wood. Work out the surface area with the square footage calculator (length × height, both sides).
- Rules: many towns and HOAs limit fence height and placement or require a permit. Call your local utility-locating service before digging post holes.
Planning other outdoor work? The roof cost calculator estimates roofing materials and cost from your home’s footprint.
Frequently asked questions
How many fence posts do I need?
Divide the fence length (minus any gate openings) by your post spacing and round up to get the number of sections, then add one post to close the last section and one extra post for each gate. For 116 ft of fence at 8 ft spacing: 116 ÷ 8 = 14.5, so 15 sections and 16 posts, plus 1 for a gate = 17.
How do I calculate the number of fence pickets?
Convert the fence length to inches and divide by the picket width plus the gap between pickets. 116 ft = 1,392 in; with 5.5-inch pickets and 0.5-inch gaps, 1,392 ÷ 6 = 232 pickets. Add a few extra for cuts and damaged boards.
How far apart should fence posts be?
It depends on the fence style, materials, wind exposure and local codes. Many wood fence panels and rail lengths are designed around 6 to 8 ft spacing, but always follow the manufacturer’s instructions and any local building rules.
Does the calculator handle corners?
It treats the fence as one continuous run. If your fence has corners, it’s more accurate to calculate each straight side separately and add the results, then remove one post for each corner where two sides share a post.
Do I need a permit to build a fence?
Many towns and homeowners associations have rules on fence height, placement and materials, and some require a permit. Check with your local building department, and have underground utilities marked before you dig post holes.