A fence earns its cost in everyday ways. It gives you privacy, keeps children and pets safely in, keeps animals out of the vegetable bed, marks where your property ends and puts a visible barrier between your home and the street. All of that depends on one early decision, the post count, because posts set the spacing, the cost and whether the rails will hold. Get that number right and the rest of the job goes smoothly.
You have measured the fence line, you know how far your rails or panels can span, and you are standing in the shop with a trolley. The question is simple: how many posts? The usual answer is “length divided by spacing”, and it is wrong in two different ways. It counts gaps instead of posts, and it forgets that a real fence has ends, corners and usually a gate.
Here is the sum done properly, first for one straight run, then for a whole yard.
Step 1: divide, then round up
Say the fence run is 30 ft and your rails can span at most 8 ft between posts.
30 ÷ 8 = 3.75 gaps.
You cannot build three-quarters of a gap, so round up to 4 gaps. Rounding down to 3 would make each gap 10 ft, which is wider than your rails can span. Always round this number up, never to the nearest whole number, because the spacing is a limit, not a target.
Step 2: add one post
Picture a line of posts with the gaps between them. Each gap needs a post at both ends, but neighbouring gaps share a post. An open run (two ends) therefore has gaps + 1 posts: 4 + 1 = 5 posts.
Step 3: find the real spacing
Spread the gaps evenly: 30 ÷ 4 = 7.5 ft between posts. That is under your 8 ft limit, and every gap is identical, so the panels or rails are all the same length. Measure and mark 7.5 ft, not 8 ft. If you set posts at 8 ft from one end you finish with a short odd gap of 6 ft, and a fence looks neater when every bay matches.
Step 4: go all the way round
A closed loop, such as a yard fenced on every side, has no end posts. The last gap runs back into the first post, so the number of posts equals the number of gaps.
Take a yard that is 30 ft × 20 ft. The perimeter is 2 × (30 + 20) = 100 ft. The shortcut is to divide 100 by 8, get 12.5, and round up to 13 posts. Look at what happens when you do it side by side instead:
- Each 30 ft side needs 30 ÷ 8 = 3.75, so 4 gaps of 7.5 ft.
- Each 20 ft side needs 20 ÷ 8 = 2.5, so 3 gaps of 20 ÷ 3 = 6.67 ft.
- Total gaps: 4 + 3 + 4 + 3 = 14, so 14 posts, one of them at each corner.
The shortcut came out one post short, because each side has to be rounded up on its own. A corner post is a real post that sits between two sides, and you cannot put a post at “half a corner” to make the total work out.
Step 5: add the gate
Now say you want a 4 ft gate in the middle of one 30 ft side. The gate takes up 4 ft of the run, which leaves 30 − 4 = 26 ft of fence, or 13 ft on each side of the gate.
- 13 ÷ 8 = 1.625, so each side of the gate needs 2 gaps of 13 ÷ 2 = 6.5 ft.
- That side now has 2 + 1 (the gate) + 2 = 5 gaps instead of 4.
- The yard therefore has 5 + 3 + 4 + 3 = 15 gaps, and since it is a closed loop that is 15 posts.
One post more than before. The two posts either side of the gate have to carry a swinging door, so you will normally choose a sturdier post for those. Your shopping list is then 13 ordinary posts plus 2 gate posts, 14 fence bays and one gate.
Step 6: check the spacing you ended up with
Before you buy, read the spacing off your sketch, side by side.
- 30 ft side: 7.5 ft. 20 ft sides: 6.67 ft. Either side of the gate: 6.5 ft. All three are under 8 ft, so the plan works.
- If any number comes out above your limit, add a gap to that side and recount.
The bays are not all the same length around the yard, and that is normal. They only need to be the same along each straight side, so that the panels on one side match each other.
Common slips
- Dividing the whole perimeter once. Round each side separately.
- Forgetting the +1 on an open run. A fence along one boundary has two ends; a loop has none.
- Forgetting that a gate is a gap. Its two posts are part of the count, but the opening itself is not a fence bay, so do not buy rails for it.
- Rounding spacing down. 8 ft is a maximum. Round the gap count up and let the spacing shrink.
Rule of thumb
Gaps = length ÷ maximum spacing, rounded up. Open run: posts = gaps + 1. Closed loop: posts = gaps. Do each side separately and sketch the gate before you buy.
Count your own run
The free Fence Post Counter does open and closed runs with corners and gates, and gives the real spacing. It comes from Fences That Stand Straight, Book 2 of Built by Numbers.
This is arithmetic for planning, not an engineering design. Follow your local building department and the product instructions.