Baluster Spacing Calculator
Space balusters evenly across a railing opening while staying under the code gap limit.
Balusters needed
How even baluster spacing is calculated
Guard rail codes limit the open gap between balusters so a sphere of a certain size (commonly 4 inches, meant to represent a small child's head) can't pass through. The challenge in the field is spacing balusters evenly across an opening while keeping every single gap under that maximum — equal spacing looks better and is far easier to lay out than a mix of gap sizes.
This calculator first finds the minimum number of balusters required so that, if they were spaced at exactly the maximum allowed gap, they'd still fill the opening: n = ceil[(opening width − max gap) ÷ (max gap + baluster width)]. It then spreads that many balusters evenly across the opening and solves for the actual gap: actual gap = (opening width − n × baluster width) ÷ (n + 1), since there is always one more gap than the number of balusters (one gap on each end plus one between each pair).
Because the baluster count is rounded up to a whole number, the actual, evenly-distributed gap comes out slightly smaller than your maximum, which keeps the layout safely under code with room to spare.
Where these numbers come from
The formula and default values in this calculator are based on:
- 4-inch sphere rule is a common residential guard/handrail baluster spacing limit found in the International Residential Code (IRC) and widely adopted local building codes; confirm your jurisdiction's exact requirement before building.
These are planning estimates. Check your local building code, product specifications, and a licensed contractor before you buy materials or build.
Frequently asked questions
What is the standard maximum gap for deck railing balusters?
Many residential codes, including the IRC, commonly limit openings in guards to 4 inches (so a 4-inch sphere cannot pass through), with a larger allowance near stair treads in some codes. Requirements vary by jurisdiction, so confirm the exact limit with your local building department.
Why is the actual gap always a little smaller than the maximum I enter?
Because the number of balusters has to be a whole number, rounding up to the next full baluster leaves slightly less room per gap than the exact maximum would allow. That's intentional -- it keeps the finished railing safely compliant rather than exactly at the legal edge.
Does baluster width mean the face width or the diagonal measurement?
Use the actual face width of the baluster as it's installed flat against the rail line (for a square baluster installed square-on, that's simply its side dimension). If balusters are installed at an angle or are a different profile, use the width they present across the opening.
Not happy with our calculations or how it works? Let us know.
Have a suggestion for a calculator you don't see here? Let us know.
All LumberCalcs tools
Framing & Structural
Board Foot Calculator Plywood Calculator Rafter Calculator Rafter Length Calculator Joist Span CalculatorNo calculators match your search.