Skip to content
DIY Measures
Menu

Fence Calculator

Plan the materials for a straight wood fence. Enter the length, height and post spacing, the rails per section and your picket size, and get the posts, rails and pickets to buy, plus a suggested post length.

  • Imperial and metric
  • Formula and working shown
  • Last reviewed

Your fence

Units

The total length of the fence line. Work out each straight run separately if it has corners.

Wood fence guides commonly suggest about 6 to 8 ft (1.8 to 2.4 m). Match the length of your rails or panels.

A Lowe’s guide suggests one rail for every 2 ft of post height: usually 2 for a 4 ft fence and 3 for a 6 ft fence.

Enter 0 for a privacy fence with boards side by side.

Results update as you type. You can enter fractions such as 3 1/2.

Result

Enter the fence length to see how many posts and pickets you need.

Calculated in your browser. Nothing you type is sent anywhere.

Quick answer: Posts = fence length ÷ post spacing, rounded up, plus one. A 100 ft fence with posts 8 ft apart has 13 sections and needs 14 posts, plus extra posts for corners and gates.

How to use the fence calculator

  1. Enter the length of one straight run of fence, and its height above ground.
  2. Enter the post spacing and the number of rails per section.
  3. Enter the picket width and the gap between pickets (0 for a privacy fence).
  4. Read the posts, pickets and rails. Repeat for each straight run, and add gate posts.

Post spacing and depth

Fence heightRails (one per 2 ft)Post length if 1/3 is buried
4 ft (1.2 m)26 ft (1.8 m)
5 ft (1.5 m)2 to 37.5 ft (2.3 m)
6 ft (1.8 m)39 ft (2.7 m)

These are common guide figures, not rules. Frost depth, soil, wind and local codes can require deeper posts.

Before you build

  • Check your property line, local height limits and whether a permit is needed.
  • Call your local utility-locating service before digging post holes.
  • Use the Concrete Calculator (round column or post hole) to estimate concrete for each post.

How do you calculate fence posts, rails and pickets?

A wood fence with posts, three rails and pickets, showing post spacing and the part of each post set in the ground
Posts = fence length ÷ post spacing, rounded up, plus one. Add posts for corners and gates.

Sections and posts

Sections = fence length ÷ post spacing, rounded up; posts = sections + 1

A straight run needs one more post than sections. Fence guides suggest posts about 6 to 8 ft apart.

Rails and pickets

Rails = sections × rails per section; pickets = fence length ÷ (picket width + gap), rounded up

A Lowe’s guide suggests one rail for each 2 ft of post height.

Post length

Post length ≈ fence height × 3 ÷ 2 (about 1/3 of the post buried)

If one third of the post is in the ground, the part above ground is two thirds of its length.

Worked examples

A 100 ft privacy fence, 6 ft high, posts 8 ft apart, 5½ in pickets

  1. Sections: 100 ÷ 8 = 12.5, rounded up to 13. Posts: 13 + 1 = 14.
  2. Rails: 13 × 3 = 39.
  3. Pickets: 1,200 in ÷ 5.5 in = 218.2, rounded up to 219.
  4. Post length: 6 × 3 ÷ 2 = 9 ft, with 3 ft in the ground.

A 30 m fence, 1.8 m high, posts 2.4 m apart, 140 mm boards (metric)

  1. Sections: 30 ÷ 2.4 = 12.5, rounded up to 13. Posts: 14.
  2. Rails: 13 × 3 = 39.
  3. Pickets: 30,000 mm ÷ 140 mm = 214.3, rounded up to 215.
  4. Post length: 1.8 × 3 ÷ 2 = 2.7 m, with 0.9 m in the ground.

Assumptions and limitations

This calculator assumes

  • One straight run with posts at equal spacing; pickets run the full length.

What it does not cover

  • Corners, gates and changes of direction need extra posts and hardware.
  • Post depth also depends on frost depth, soil and wind; local rules may require deeper posts or permits.
  • Concrete for posts is not included; use the Concrete Calculator (column) for each post hole.

Not professional advice

Results are estimates for planning and buying materials. For structural work, follow your local building code and ask a qualified professional.

Questions and answers

How many fence posts do I need?

Divide the fence length by the post spacing, round up to get the number of sections, and add one post. A 100 ft fence with posts 8 ft apart has 100 ÷ 8 = 12.5, so 13 sections and 14 posts. Add posts for corners and gates.

How far apart should fence posts be?

Wood fence guides commonly suggest about 6 to 8 ft (1.8 to 2.4 m). Closer spacing makes a stronger fence, especially in windy places. Match the spacing to the length of your rails or panels.

How many pickets do I need?

Divide the fence length by the picket width plus any gap. For a 100 ft privacy fence with 5½ in pickets and no gap: 1,200 in ÷ 5.5 in = 218.2, so 219 pickets.

How deep should fence posts be?

A common rule in fence guides is to bury about one third of the post. For a 6 ft fence that means a 9 ft post with 3 ft in the ground. In cold climates posts often need to go below the frost line, so check local practice.

How many rails does a fence need?

A Lowe’s fence guide suggests one rail for each 2 ft of post height. Many 4 ft fences use 2 rails and many 6 ft fences use 3.

Guides that explain this

Sources and review

Review status: Checked against the sources below, with a hand-calculated example. Last reviewed .

  • Standard geometry (area and volume formulas). Rectangle area = length × width; circle area = π × (diameter ÷ 2)²; triangle area = base × height ÷ 2; rectangular prism volume = length × width × depth; cylinder volume = π × r² × height; right-angle trigonometry: angle = arctan(rise ÷ run), sloped length = √(rise² + run²). Accessed 2026-12-02.
  • Millard Lumber: Building Wood Fences (PDF guide). Set fence posts about 6 to 8 ft apart; bury about 1/3 of the post’s total length; keep the bottom rail at least 2 in above the ground. Accessed 2026-12-02.
  • Lowe’s: Wood Fence Installation Tips, Installing Posts and Pickets (PDF). Use one rail (stringer) for each 2 ft of post height, with the bottom stringer at least 6 in above the ground. Accessed 2026-12-02.