Baluster spacing calculator
The rule is simple: a 4-inch sphere must not pass through any opening. The arithmetic is not. You cannot divide the rail length by 4, because the posts and the balusters themselves take up space, and the gap count is one more than the baluster count.
Rail section
How this is calculated
Let L be the clear span, b the baluster width, and g the maximum gap. With n balusters there are n + 1 gaps, and they must satisfy:
(n + 1) × g + n × b ≤ L
Solving for the smallest integer n that works:
n = ⌈(L − g) ÷ (b + g)⌉
Then the real gap is (L − n × b) ÷ (n + 1), and centre-to-centre spacing is b + gap.
Worked example
A 96″ section between two 4×4 posts (3.5″ actual), with 2×2 balusters (1.5″ actual) and a 4″ limit:
- Clear span = 96 − 2 × 3.5 = 89″
- n = ⌈(89 − 4) ÷ (1.5 + 4)⌉ = ⌈85 ÷ 5.5⌉ = ⌈15.45⌉ = 16 balusters
- Real gap = (89 − 16 × 1.5) ÷ 17 = 65 ÷ 17 = 3.82″
- Centre-to-centre = 1.5 + 3.82 = 5.32″
Sixteen balusters leave 3.82″, which passes. Fifteen would leave (89 − 22.5) ÷ 16 = 4.16″, which fails — and it fails by a quarter inch, which is exactly the kind of margin an inspector finds with a tape measure.
Why you should aim below 4 inches, not at it
Pressure-treated lumber shrinks as it dries. A 2×2 baluster can lose 1/16″ of width, and the gap grows by the same amount on both sides of every baluster. A layout that computes to 3.98″ can measure 4.05″ a season later.
The practical rule used by most builders is to target 3.75–3.9″ so that shrinkage, a slightly crowned baluster or a post that is not perfectly plumb still leaves margin. On a long run it also lets you absorb the fractional leftover in the gaps rather than in one conspicuous wide space at the end.
The cases the 4-inch rule does not cover
- It does not decide whether you need a guard. That depends on deck height and is a code question — see guard requirements.
- It does not handle cable or glass infill. Both have manufacturer spacing rules and deflection limits that this arithmetic does not model.
- It assumes equal bays. If the section is not a multiple of your bay length, you have to solve each bay separately; the tool does multiply by bay count, so enter the average.
- It does not include a bottom rail thickness check. Some codes require that the gap under the bottom rail also be closed to 4″, which adds a rail or a solid infill.
Questions people actually ask
How far apart should balusters be on a deck?
Close enough that a 4-inch sphere cannot pass through any opening. With 2×2 balusters that works out to roughly 3.8 inches of clear space, or about 5.3 inches centre to centre. Never divide the rail length by four — the balusters themselves consume space.
Is the 4-inch rule measured between balusters or centre to centre?
Between the inside faces of two adjacent balusters, at the widest point of the opening. Centre-to-centre spacing is a layout convenience; the measurement that matters is the clear gap.
Can I use 2x2 or 1x2 balusters?
Both are common. A 1×2 is 3/4 inch thick, which leaves more room for gap and looks lighter, but it is also easier to break and some inspectors will not accept it as a guard infill. A 2×2 at 1.5 inches is the safer choice on a deck that will see children.
Does the spacing change if the deck is more than 30 inches high?
No, but whether you need a guard at all does. Above 30 inches a guard is required, and once a guard exists the 4-inch sphere rule applies to every opening in it.