Roofing & Exterior

Fence Calculator

Plan a post-and-rail fence: enter the total run, post spacing and gates to get posts, rails and the bags of concrete to set them.

Updated Oct 2, 2026A free tool from homesblogs

What is a fence calculator?

A wood fence is built from posts set in concrete, horizontal rails between them and pickets fastened to the rails. This tool counts the structural parts; for the boards themselves use the Fence Picket Calculator.

How does it work?

Dividing total length by post spacing and rounding up gives the number of sections. Posts are one more than sections, plus one per gate. Rails are sections × rails per section, and concrete is posts × bags per post. For round footings, the Sonotube Concrete Calculator gives exact volumes.

What information is needed?

  • Total fence length in feet
  • Post spacing (6 or 8 ft)
  • Rails per section
  • Number of gates

How to use the Fence Calculator

  1. Measure the fence line along the ground, including gates.
  2. Choose post spacing — 8 ft is standard for 2×4 rails.
  3. Choose rails: 2 for fences up to 4 ft, 3 for 5–6 ft.
  4. Enter gates and select Calculate.

The formula

In plain terms, here is the calculation the tool runs:

Sections = ⌈Length ÷ Spacing⌉
Posts = Sections + 1 + Gates
Rails = Sections × Rails per section
⌈ ⌉
Round up to the next whole number
Spacing
Distance between post centres in feet

Worked example

Example

A 150 ft run with posts 8 ft apart, three rails and one gate.

  1. 150 ÷ 8 = 18.75 → 19 sections
  2. 19 + 1 + 1 gate = 21 posts
  3. 19 × 3 = 57 rails
  4. 21 × 2 = 42 bags of concrete

21 posts, 57 rails and 42 bags of concrete.

Frequently asked questions

How deep should fence posts go?

A common rule is one third of the post length in the ground, and below the frost line in cold climates — often 30–48″.

Should I use 6 ft or 8 ft spacing?

8 ft uses fewer posts and matches rail lengths. Use 6 ft in windy areas or for heavy board-on-board fences.

Do gates need special posts?

Yes. Use 6×6 or heavier 4×4 posts at gates, set deeper, because they carry the gate’s weight.

Related tools

All tools

Related articles

All articles