Fence Calculator
Posts, sections and rails for a fence run at your spacing, with rail length and a waste allowance.
What the fence calculator does
It divides the run into sections and counts the material those sections need. Sections = ceil(run / post spacing), posts = sections + 1, and rails = sections × rails per section. A 30 m run at 2.4 m spacing is 13 sections, 14 posts and 26 rails, and the rail length is 30 m × 2 rails plus the 10 % waste, which is 66 m.
The extra post is the one that closes the last section. The rail length is the run multiplied by the rails per section, so it counts the rails end to end rather than per section, and the waste percentage you type is applied to that length only.
This is an ordering estimate, not a structural specification. Gates are not counted: a gate changes the posts, the rails and the run, so a run with a gate must be split by hand. The page refuses a run or spacing of zero or below, more than 5 rails per section, and a waste percentage past 50.
Figures print to up to four decimal places with trailing zeros trimmed.
How to use it
Set Fence run in metres and Post spacing in metres; the spacing is the distance between post centres.
Set Rails per section to the number of rails one section carries, set Waste to the allowance you buy for, and press Run. The result prints the sections, the posts, the rails and the rail length.
Worked example
Input with the defaults:
Fence run 30 m, post spacing 2.4 m, 2 rails, 10 % waste
Output:
Sections: 13 (ceil(30 ÷ 2.4))
Posts: 14 (one more than the sections)
Rails: 26 (13 sections × 2)
Rail length: 66 m (30 × 2 rails + 10 % waste)
Why it runs in your browser
The counts are computed in this tab. Your run and spacing are never uploaded.
The page divides a fence run into equal sections and counts the material those sections need: posts, sections and rails. Sections = ⌈run / post spacing⌉, posts = sections + 1, and rails = sections × rails per section.
A 30 m run at 2.4 m spacing is 13 sections and 14 posts. At two rails per section the rail count is 26, and the rail length adds the waste you type: 30 m × 2 rails × 1.10 is 66 m.
The counts are an ordering estimate, not a structural specification. Gates are not counted — a gate changes the posts, the rails and the run — and the page says so rather than guessing where one goes.
Why the post count is one more than the sections
A section is the span between two posts, so a run with n sections needs a post at each end and one at every join: n + 1. That final post is the one the page adds, and it is why a 13-section run has 14 posts rather than 13.
The rail length is the run multiplied by the rails per section, not a per-section sum. It is the same length either way for equal sections, and it stays right when the last section is shorter, which is what ⌈⌉ produces.
Where the estimate stops
A gate breaks the run into two runs and adds posts of its own, so the page does not count one. Split the run at the gate and add the gate's posts and rails by hand; the page states this instead of implying a complete take-off.
The waste percentage applies to the rail length only. Posts are counted whole, because a post is not ripped and a spare is a decision rather than a percentage. The page prints the waste it applied so a different allowance is a typed value, not a hidden constant.
How to use Fence Calculator
Set Fence run and Post spacing in metres; the spacing is measured between post centres, which is how a fence is laid out.
Set Rails per section to the number of rails one span carries, and set Waste to the allowance you buy for.
Press Run. The result prints the sections, the posts, the rails and the rail length with the waste already applied.
What to Expect
Best for
- Counting posts, sections and rails for a straight run
- A quick material order before a site measure
- Comparing a 2.4 m spacing with a 1.8 m one
Not ideal for
- A run with gates, corners or a slope, which changes the posts at those points
- A structural specification, which the page does not claim to be
What this tool keeps
- The run, the spacing and the rails per section you typed
- The counts and the waste the page applied
What may need cleanup
- A spacing measured from post edges rather than centres
- A run in feet, which has to be converted to metres
Common errors
- Forgetting the closing post, which the page adds for you
- Expecting gates to be counted, which the copy says are not
Example use cases
- Ordering posts and rails for a garden fence
- Checking a contractor's section count
- Comparing two post spacings for cost
Sample input
30 m run, 2.4 m post spacing, 2 rails, 10 % waste.
Sample output
13 sections, 14 posts, 26 rails, 66 m of rail.
Who this is for
- Homeowners and fencers ordering a straight run
- Anyone checking a section count
Frequently asked questions
Why is there an extra post?
Each section spans two posts, so a run with n sections needs n + 1 posts: one at each end and one at every join. The page adds that post, which is why 13 sections has 14 posts.
Are gates included?
No. A gate breaks the run and adds posts and rails of its own, and its width is not a value this page asks for. Split the run at the gate and add the gate's material by hand.
What does the waste percentage cover?
Rail length, because rails are cut and a spare length is normal. Posts are counted whole rather than wasted, since a spare post is a decision rather than a percentage.
Is this a building-code check?
No. It is ordering arithmetic. Post depth, footing size and the maximum span are structural questions this page does not answer.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.