Fence Calculator
Lay out a fence run by run: count posts, panels and rails from each run length, post spacing and gates, with shared corner posts and gate posts made explicit.
Your estimate
Enter your measurements to see an estimate.
Estimate only. Verify dimensions, product data and local requirements before ordering, and consult a qualified professional where structure or code applies.
How to use this calculator
- What to measure
- Walk the fence line and split it into straight runs between corners and ends. Measure each run and note how many gates it contains. Decide your post spacing, which is usually the panel width.
- Units
- Imperial: feet for runs, spacing and gate width. Metric: metres.
- Reading the result
- Use the total post count for ordering, and the per-run figures when setting out. Buy gate hardware and any heavier gate posts separately.
Formula
| Variable | Meaning |
|---|---|
| Lᵢ | Length of run i |
| gᵢ | Gates in run i |
| G | Gate opening width |
| s | Post spacing |
| c | Shared corners: runs − 1 if connected, runs if a closed loop |
Bays in run i = ⌈ (Lᵢ − gᵢ × G) ÷ s ⌉ Posts in run i = bays + 1 + gᵢ Total posts = Σ posts − c Rails = Σ bays × rails per bay
Bays are rounded up per run, so every bay is no longer than the post spacing.
Worked example
Three connected runs of 50 ft, 30 ft and 50 ft, with one 4 ft gate in the middle run, 8 ft post spacing and 2 rails per bay.
- Run 1: ⌈50 ÷ 8⌉ = 7 bays → 8 posts
- Run 2: ⌈(30 − 4) ÷ 8⌉ = 4 bays → 4 + 1 + 1 = 6 posts
- Run 3: ⌈50 ÷ 8⌉ = 7 bays → 8 posts
- Posts = 8 + 6 + 8 − 2 shared corners = 20
- Panels = 18, rails = 18 × 2 = 36
| Total posts | 20 posts |
|---|---|
| Panels or bays | 18 panels |
| Rails | 36 rails |
| Gates | 1 gate |
| Shared corner posts | 2 posts |
| Total fence line | 130.0 ft |
| Run 1 posts (standalone) | 8 posts |
| Run 1 panels | 7 panels |
| Run 2 posts (standalone) | 6 posts |
| Run 2 panels | 4 panels |
| Run 3 posts (standalone) | 8 posts |
| Run 3 panels | 7 panels |
Reference
| Fence type | Spacing |
|---|---|
| Wood privacy, 6 ft panels | 6 ft (1.8 m) |
| Wood privacy or picket, 8 ft panels | 8 ft (2.4 m) |
| Vinyl panels | 6–8 ft, to suit the panel |
| Chain link | up to 10 ft (3 m) |
| Post and rail, farm | 8–10 ft (2.4–3 m) |
Follow the manufacturer's spacing for panels, and local wind and code requirements.
Questions
Why does a gate add a post?
The fence section ends at one gate post, and a second post hangs or latches the gate on the other side. One of those is already the end of a bay, so each gate adds one post to its run.
What's the difference between connected runs and a closed loop?
Connected runs share a post at each corner between them. A closed loop also joins the last run back to the first, which shares one more post.