Fence Calculator

Work out the materials for a straight fence run: how many posts, panels and rails you need from the total length and your post spacing. Handles the classic "one more post than panels" catch.

Standard panels are ~1.8–2.4 m wide
2 for low fences, 3 for tall/heavy panels
Result

How to use this calculator

  1. Enter the total fence length and your post spacing (panel width).
  2. Set rails per panel — 2 for short fences, 3 for tall or heavy ones.
  3. Enter any gates; each needs its own post and creates an opening.

Formula used

Panels = ⌈Length ÷ spacing⌉  ·  Posts = Panels + 1 (+ gate posts)

The "+1" is the fencepost problem: a run of N panels needs N+1 posts, because each panel sits between two posts and they share. Corners and changes of direction each add one more post.

Example calculation

Worked example

A 30 m fence with 2.4 m panels and one 1 m gate: fence line ≈ 29 m → 13 panels, needing 15 posts (13 + 1 closing post + 1 gate post) and 39 rails.

Forgetting the +1 leaves your run one post short — the fence literally can't close.

The fencepost problem, literally

Fences are the original illustration of the "off-by-one" problem: because each panel is bounded by a post on each side and adjacent panels share posts, a straight run of N panels always needs N+1 posts. Count panels and forget the closing post and you're one short — a mistake that only reveals itself at the very end of the run.

Corners, gates and direction changes each break the sharing and demand an extra post, and gates also interrupt the panel line. Getting posts right matters most because they're the concreted-in structural element — miscounting panels means another trip to the supplier, but miscounting posts can mean digging fresh holes after the concrete's already set.

Why use this calculator?

Frequently asked questions

How many posts do I need for a fence?

One more than the number of panels in a straight run (N panels need N+1 posts), plus an extra post at each corner, direction change and gate. A 30 m fence in 2.4 m panels needs ~13 panels and 14+ posts.

How far apart should fence posts be?

Typically 1.8–2.4 m, matching standard panel widths. Closer spacing gives a sturdier fence in windy or exposed areas; wider spacing uses fewer posts but needs stronger rails and panels.

How deep should fence posts go?

A common rule is a quarter to a third of the post's above-ground height in the ground — so a 1.8 m fence wants posts set ~0.6 m deep, in concrete. Taller and exposed fences need deeper, wider footings.

Related calculators