Fence planning tool
Fence Post and Rail Calculator
Estimate the posts and rails for one straight fence run. Enter the run length, the largest post spacing you plan to use, and the number of rails in each section.
Fence run
Enter the run length, spacing, and rails
Enter the largest center-to-center post spacing you plan to use. The calculator spaces the posts evenly at or below it and does not recommend a spacing.
Purchase quantity
Posts and rails required
Enter a post spacing and rails per section to see your result
Use the largest post spacing you plan to use and the number of rails in each section to count posts and rails for the run.
How it works
From run length to posts and rails
Quick answer
The calculator divides the run into the fewest equal sections no longer than your maximum post spacing, adds one post for the end of the run, and multiplies the sections by your rails per section.
Fence post and rail formula
Sections = Run length ÷ Maximum post spacing, rounded up
Posts = Sections + 1
Rails = Sections × Rails per section
Actual post spacing = Run length ÷ Sections
Rounding the sections up keeps every gap between posts at or below your maximum spacing, and the posts are then spaced evenly along the run.
Worked example: 100 ft run, 8 ft maximum spacing, 2 rails
- Divide the run by the maximum spacing100 ÷ 8 = 12.5
- Round up to whole sections13 sections
- Add one post for the end of the run13 + 1 = 14 posts
- Multiply sections by rails per section13 × 2 = 26 rails
- Space the posts evenly100 ÷ 13 ≈ 7.69 ft
Post spacing and rails per section
The maximum post spacing and the number of rails are your own choices, and the calculator recommends neither. Spacing is measured from the center of one post to the center of the next. How long each rail must be depends on how it attaches to the posts, so check the rail product and your fence plan before cutting or buying rail lengths.
Estimate limitations
This calculator counts posts and rails for one straight run with evenly spaced posts. It does not add posts for corners, gates, or separate runs, and it does not determine post size, depth, footing, or any structural requirement.
Frequently asked questions
- Why is there one more post than sections?
- Each section sits between two posts, so a straight run needs a post at each end and one between every pair of sections.
- Why is the actual spacing smaller than my maximum?
- The run is divided into whole sections of equal length. When the run is not an exact multiple of your maximum spacing, the sections come out a little shorter than it.
- Does it handle corners and gates?
- No. It counts one straight run. Calculate each straight run separately, and plan corner, end, and gate posts yourself.
- Does it recommend a post spacing or post depth?
- No. It only counts material for the spacing you enter. Use project plans, local requirements, and qualified professional guidance where required.
- Can I use Metric units?
- Yes. Metric mode accepts the run length and the maximum post spacing in meters, and keeps the same physical values when you switch.
Keep planning