Fence Calculator

Calculate how many posts, rails, pickets or panels you need for a fence, and estimate the material cost.

About the Fence Calculator

This fence calculator estimates the posts, rails, pickets or panels for a fence from its total length. It subtracts gate openings, divides the run by your post spacing and counts individual pickets from their width and gap. Add your local prices to get a material cost, then add concrete, hardware and labor.

How to use it

  1. Enter the total fence length, post spacing and the number and width of gates.
  2. Choose picket or panel fencing and enter the picket size or leave the defaults.
  3. Enter your prices, then press Calculate fence.

Fence formulas

  • Posts = (fence length − gates) ÷ spacing + 1 + gate posts
  • Pickets = fence run ÷ (picket width + gap)
  • Rails = sections × rails per section (usually 2 or 3)

Typical fence heights

UseCommon height
Front yard decorative3 to 4 ft
Backyard privacy6 ft
Pool barrier4 ft or more, check local code
Pet containment4 to 6 ft

Check local codes and HOA rules, and call 811 before digging post holes.

Frequently asked questions

How many fence posts do I need?

Divide the fence run by the post spacing (usually 6 to 8 feet) and add one, plus extra posts for gates and corners.

How many pickets do I need per foot?

About 2 pickets per foot for 5.5 inch pickets with a small gap, or 1 per 6 inches. The calculator computes it for you.

How much does a fence cost?

Costs vary by material and region. Wood fences commonly run about $15 to $40 per linear foot installed, while vinyl and metal cost more.

How far apart should fence posts be?

Six to eight feet is standard for wood fences. Closer spacing makes a stronger fence.

Do I need a permit for a fence?

Often yes, depending on height and location. Check with your city or HOA.

Last reviewed: November 2026.

Related free tools

Concrete calculator Mulch calculator Gravel calculator Square footage calculator Roofing calculator Paint calculator