Fence Calculator
This fence calculator estimates bays, posts and one-bay rail pieces from total length, maximum post-centre spacing and rail rows. It distinguishes a single open straight run from an ideal closed loop, with no gates, and reports the equalised spacing needed to stay within your entered maximum.
By Dr. Hassan Khames EliwaLast updated
Result
- Bays
- 13
- Equalised centre spacing
- 2.31 m
- One-bay rail pieces
- 39
- Nominal rail centreline length
- 90.00 m
How it works
Count bays before counting posts
Bays = total fence length ÷ maximum post-centre spacing, rounded upward. Equalised centre spacing = total length ÷ bay count. Rounding upward keeps that equalised spacing at or below the maximum you entered. The maximum is your project input, not a structural recommendation supplied by the calculator. Metric mode uses metres; imperial mode uses feet for both length and spacing.
An open run needs one more post than bays because it has two free ends. A closed loop shares its final post with the first bay, so its post count equals its bay count. The closed model requires at least three bays. It assumes posts can be distributed around the loop without additional location constraints. A real rectangle may need more bays when each side must end at a corner post.
Translate bays into rail quantities
One-bay rail pieces = bays × rail rows per bay. This assumes one rail piece spans one bay in each row. Nominal rail centreline length = total fence length × rail rows. Neither result is a stock-cutting schedule. Actual rail cut lengths depend on post width, brackets, overlaps and the connection detail, while commercial stock lengths determine offcuts.
This distinction matters when comparing timber and metal systems. A rail that fixes between posts is not cut to the same length as one lapped across their faces. The centreline total is useful for an initial material comparison but cannot tell the yard how to cut every piece.
Keep the scope deliberately narrow
There are no gate openings, corner-post rules, braces, infill boards, mesh, fixings or post foundations in this model. Length and spacing must be positive and no greater than 100,000. Rail rows must be a whole number from one to twenty, and the layout is limited to one million bays. These limits prevent unsupported numerical results; they do not establish that a fence design is suitable for wind, ground conditions or use.
Worked example
Scenario 1: an open metric boundary
A straight open fence is 30 m long with a maximum post-centre spacing of 2.4 m and three rail rows. The division gives 12.5, so the layout needs 13.00 bays. An open run therefore needs 14.00 posts. Equalised centre spacing is displayed as 2.31 m. There are 39.00 one-bay rail pieces and 90.00 m of nominal rail centreline length. Use the unrounded spacing for setting out rather than repeatedly measuring 2.31 m.
Scenario 2: an ideal imperial loop
A continuous closed loop has a total length of 160 ft, maximum spacing of 8 ft and two rail rows. It requires 20.00 bays and 20.00 posts. Equalised centre spacing is 8.00 ft, with 40.00 one-bay rail pieces and 320.00 ft of nominal rail centreline length. This result is only directly applicable if required corners and other fixed post positions align with that distribution.
Turn the preliminary count into a layout
Mark end posts, corners and gate positions on a drawing before ordering. Divide each constrained straight segment separately, then reconcile shared corner posts so they are neither omitted nor counted twice. A small change in one segment can add a whole bay even when the overall perimeter barely changes.
Expert tips
Common mistakes
- Subtracting a gate width from the total and stopping there. Gates introduce opening posts and divide the remaining fence into separate runs. This calculator excludes gates because simple subtraction can miss both posts and bay-rounding effects.
- Treating centre spacing as clear opening. The distance between post centres includes portions of both posts. Rail and panel clearances depend on the actual post section and connection detail, not just the centreline result.
- Ordering stock from total rail length alone. Several short pieces cannot always be replaced by one long piece, or vice versa. Match required cuts to available stock and include connection allowances before purchasing rails.
Frequently asked questions
Why does an open fence have an extra post?
Each bay lies between two posts. Adjacent bays share their intermediate posts, but the two free ends remain, leaving one more post than the total number of bays.
Can I use the closed option for a rectangular garden?
Only as an initial estimate when the required corner positions fit the bay arrangement. For a dependable rectangle takeoff, divide each side separately and count each shared corner post once.
Does the calculator choose a safe post spacing?
No. You enter the maximum allowed by the selected system or design. Wind exposure, fence height, infill, post strength and foundation conditions require their own checks.
How do I handle a sloping fence line?
Decide whether the system follows the slope or steps between posts, then use the appropriate measured geometry and connection details. The simple equal-spacing model does not resolve panel stepping or changing rail lengths.
Does it include concrete for the posts?
No. Establish the required footing dimensions independently, deduct displaced post volume where appropriate and use the concrete calculator for that separate quantity. Hole dimensions are not a substitute for a foundation design.
Related calculators
Related guides
Construction & ProjectHow to order concrete without running short or overpayingA field-focused guide to concrete quantities, thickness checks, sensible allowances and the delivery details that prevent expensive surprises.14 November 2026 · 7 min read
Construction & ProjectThree-point estimating: when PERT beats a single guessA practical guide to three-point duration estimates, weighted averages and the limits of turning uncertain activities into a promised date.14 November 2026 · 7 min readSources and standards
About the author
Dr. Hassan Khames Eliwa holds a PhD in Construction & Built Environment and has more than 20 years of international project controls experience. He is Director of Eliwa Project Controls Limited in Auckland and founder of PMMilestone.org and PMMilestone.com.
Buy me a coffee