Baluster Spacing Calculator
Enter a rail opening and baluster width and get the number of balusters and the exact even gap — sized to stay under the code 4-inch sphere rule.
gap = (opening − 6 × 1.5″) ÷ 7 = 3.86 in
Balusters have to be close enough that a small child cannot slip through, and the building code puts a number on it: the gap must be small enough that a `4`-inch sphere cannot pass. The trick is fitting a whole number of balusters into the opening between posts so every gap comes out equal and every gap stays under that limit.
Picture the opening as a row of balusters with a gap on each side of every one — for `n` balusters there are always `n + 1` gaps. The minimum number of balusters that keeps each gap at or under the maximum is the opening minus one maximum gap, divided by the sum of a baluster's width and one maximum gap, rounded up. Rounding up only tightens the spacing, so the real gap always lands under the `4`-inch ceiling. Once the count is set, the exact even gap is the leftover space — the opening minus all the baluster widths — divided evenly among the `n + 1` gaps.
Enter the clear opening between your posts and the width of one baluster, and the tool returns the baluster count and the precise gap to mark out. Measure each opening separately, because posts are rarely a tidy distance apart, and lay out from the centre so any rounding falls evenly at the ends.
balusters = ceil((36 − 4) ÷ (1.5 + 4)) = ceil(32 ÷ 5.5) = ceil(5.82) = 6
gap = (36 − 6 × 1.5) ÷ 7 = 27 ÷ 7 = 3.86 in (under 4 in)