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.

Inputs
ft
in
Results update as you type — no submit
ResultsLIVE
Balusters
6 balusters
3.86 in even gap
Even gap
3.86 in
≈ 9.8 cm · under 4″
Even gap3.86 in
Even gap3.86 in (9.8 cm)
Opening3′ (36″)
Baluster width1.5″
Formula
balusters = ceil((36″ − 4″) ÷ (1.5″ + 4″)) = 6
gap = (opening − 6 × 1.5″) ÷ 7 = 3.86 in
Diagram — rail elevationNTS
3′ (36″)GAP 3.86″6 BALUSTERS · GAP < 4″ (IRC R312)

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.

Worked example
Opening 36 in · baluster width 1.5 in · code gap under 4 in
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)
Guard infill must not allow a 4-inch sphere to pass, so the clear gap between balusters has to stay under 4 in. This calculator sizes the count so the even gap lands below that limit; the worked example above comes out to 3.86 in.
SOURCESIRC R312.1.3 (4-inch sphere rule); even-gap layout from the post/gap identity (gaps = balusters + 1)
Gaps sized under the IRC 4-inch sphere rule — confirm each opening with your local inspector.