Fence rail calculator
Work out how many horizontal rails a fence run needs from its length, post spacing and rails per section, with the math shown.
Rails needed
Enter your measurements and the result updates as you type.
Overview
Rails are the horizontal members a wooden fence hangs its pickets on, and the common question is deceptively simple: how many boards do I buy? The answer is sections times rails per section, where sections come from your run length divided by post spacing.
Rails per section is a height decision: 2 rails on a low fence, 3 on the usual 5 to 7 foot range, 4 on an 8 foot fence, and split-rail or ranch styles fix the rail count per section by design. Type your numbers and the rail count, sections and total linear feet of rail all update at once.
Assumptions
- Sections equals run length divided by post spacing, rounded up, which counts the final partial section.
- Rails per section is a number you set, defaulting to 3 for the typical 5 to 7 foot fence.
- Total rail count is sections times rails per section, then bought as stock-length boards, so the answer accounts for every section rather than just counting a single run of boards.
Common mistakes
- Multiplying the run length directly by rails per section instead of computing sections first, which overstates rails by one section on runs that do not divide evenly.
- Using 2 rails on a 6 foot privacy fence where 3 is the safer, common choice for the board load.
- Forgetting that rails are sold in stock lengths (commonly 8, 12 or 16 feet) and that you cannot use every inch of every board.
Next step
Related calculators
- Wood fence calculator Calculate posts, rails, pickets and concrete for a pressure-treated pine, cedar or redwood fence. Every formula shown, cost optional.
- Fence post calculator Calculate line posts, corner posts and end posts from run length and spacing, with concrete for each post included in the take-off.
- Fence picket calculator Calculate exactly how many pickets you need from your fence run, picket width and gap, including a waste factor.
Related reading
In-depth guides
Buying guide
Rails are the horizontal members pickets attach to, and the count comes down to one piece of arithmetic: sections times rails per section, where sections is the run length divided by post spacing, rounded up to include the final partial section. This calculator runs that math directly rather than the shortcut of multiplying run length by rails per section, which overstates the total on any run that does not divide evenly into whole sections. It shares its underlying formulas with the general wood fence calculator, isolated here for anyone who already knows their post layout and just needs the rail count and total linear footage.
Rails per section is a height decision more than anything else: 2 rails suit a fence of 4 feet or under, 3 is the common choice for the usual 5 to 7 foot range, and 4 is typical at 8 feet or taller, since a taller board needs more support to resist cupping and twisting. Split rail or ranch-style fencing fixes its rail count by design instead, usually two or three rails with no infill at all, which is a different kind of take-off from a picket-style fence.
Posts set the section length this calculator works from, so the fence post calculator is the natural companion page for confirming spacing and total post count before committing to a rail order. Once post holes and depth are set, the fence post concrete calculator handles the concrete bag count for those same holes, rounding out the structural half of the fence before pickets go on.
Rails themselves are sold in stock lengths, commonly 8, 12 or 16 feet, so the total count here needs matching to whatever length a lumber yard actually carries plus a cut allowance, rather than assuming every inch of every board gets used. Once rail count is settled, the fence picket calculator covers the boards those rails carry. How many rails does a fence need and how many pickets for 100 feet of fence both walk through worked examples, and the wood fence installation guide covers attaching rails to posts once the counts are in hand.
Corners and end posts do not change how many rails a run needs, since a rail spans one section between two posts regardless of whether either post happens to be a corner, a terminal post or a plain line post. What corners do affect is how a rail is cut and joined where two runs meet at an angle, which is an installation detail rather than something that changes the rail count this calculator returns.
Pre-assembled vinyl and composite panel systems carry their rails built into each panel rather than as separate stock lumber, so this calculator's section-based math applies most directly to board-and-rail wood construction and to composite systems assembled the same way boards and rails are. A pre-fabricated panel system is counted by panel rather than by rail, which is a different take-off entirely from the one this page runs.
Rail orientation also affects how pickets attach: a flat rail face gives a continuous nailing surface the full width of the rail, which matters more on a style with many pickets fastened close together, like a butted privacy fence, than on a widely spaced picket style where each picket only needs to catch the rail at two points. Checking that the rail width is adequate for the fastening pattern a given style calls for is a detail that sits just outside the rail-count math itself.
On a run with a slope, rails are cut at an angle when a fence is racked to follow the grade continuously, which uses slightly more linear footage per section than a level run of the same horizontal length, since the angled cut adds a small amount to each board's effective length. That difference is usually small enough to absorb within a normal cut allowance, but it is worth knowing about before ordering the exact minimum footage a flat-ground calculation would suggest.
Rail count also interacts with how a fence is braced at gates and corners, since a gate post or corner post sometimes takes an extra diagonal brace rail in addition to the standard horizontal rails, particularly on a taller fence or in a windy area. That brace is a structural addition beyond the base rails-per-section formula this calculator runs, and it is worth budgeting separately rather than assuming the standard rail count covers every post in the run equally.
Buying rail stock in a single grade and moisture content across the whole job also helps keep the fence looking uniform over time, since rails from different batches can dry, warp or weather at slightly different rates even when they are nominally the same product, which becomes more visible on a long run than a short one.
Keeping a small reserve of uncut rail stock on hand through the first year after installation also makes it easier to match an unexpected replacement, since rails from a different batch or supplier do not always match in color or grain as closely as a board set aside from the original order.
Frequently asked questions
How many rails does a 6 foot fence need?
Three rails per section is the common suggestion for a fence between 5 and 7 feet tall. A 100 foot run at 8 foot spacing has 13 sections, so it needs 39 rails in three-rail configuration.
How do I calculate rails for a fence run?
Divide the run length by your post spacing and round up to get sections, then multiply by the rails per section you plan. This calculator does both steps and shows the sections so you can verify the arithmetic.
Why is rail count based on sections and not feet?
Because a rail belongs to a section: one horizontal member per rail slot per span between posts. Counting feet alone does not tell you how many boards to buy, especially when a run ends in a partial section.
What lengths do fence rails come in?
8, 12 and 16 feet are the common stock lengths at lumber yards. Buy long boards and cut to fit; you cannot use the waste, so buy for the sections plus a cut allowance.
How many rails run between two posts?
The number that matches your height and design: commonly 2 on a 4 foot fence, 3 on a 6 foot fence, and 4 on an 8 foot fence. Every post section carries that many rails.
Do vinyl or composite fences use rails the same way?
Pre-assembled panel systems carry their own rails built into the panels, so this calculator is for board-and-rail construction. It applies as-is to wood and to board-style composite that is assembled like wood.
How much rail footage should I buy for a 100 foot fence?
At 8 foot spacing you have 13 sections, and at 3 rails per section that is 39 boards to span roughly 104 feet of run, plus waste allowances. The calculator returns sections and total rails; match those to a stock length and a cut allowance.
Do corner and end posts change the rail count?
No. Rails span each section between posts regardless of whether a post is a corner or terminal post. Corners mainly affect how a rail is cut and joined at the corner, not how many boards to buy.