Enter the opening between your posts and the baluster width to get an even spindle layout that keeps every gap under the 4-inch code limit.
Building code (IRC R312) says a 4-inch sphere must not pass through any opening in a guard, so every gap between balusters — and between a baluster and a post — must be less than 4 inches. Even spacing means the pattern reads gap, baluster, gap, baluster, …, gap, so there is always one more gap than there are balusters. The formula that finds the smallest baluster count meeting the limit is:
Balusters = ceil((opening − max gap) ÷ (baluster width + max gap))
Once the count is set, the calculator solves for the exact even gap: (opening − balusters × baluster width) ÷ (balusters + 1). That guarantees an evenly spaced railing that passes inspection.
Close enough that no gap exceeds 4 inches. For 1.5-inch balusters that usually means roughly 5 to 5.25 inches on center, giving an even gap just under 4 inches.
Guards must not allow a 4-inch sphere to pass through, which protects small children. This tool sizes the gap to stay under that limit automatically.
Divide the opening by the maximum spacing to get the count, then recompute the exact gap so all spaces are equal. Starting and ending with a gap against each post keeps it symmetrical.
Yes. The space between the end baluster and the post must also be under 4 inches. This calculator includes those end gaps in the layout.