Building & DIY

Baluster Spacing Calculator (4-Inch Code Gap)

Find how many balusters a railing needs while keeping every gap under the 4-inch building-code limit. It handles both the US 4-inch rule and the EU/UK 100 mm rule.

Reviewed and updated

How to use
  1. Enter the total railing length.
  2. Enter the baluster width.
  3. Switch between the US 4-inch and EU/UK 100 mm code limit.
Estimates only, allow for waste and confirm against local building codes and supplier specs.
Was this helpful?

How many balusters, and how wide the gaps come out

Count = ⌊ Run ÷ ( gap + width ) ⌋,   Gap = ( Run N × width ) ÷ ( N + 1 )

"Run" is the clear railing length between the posts. One repeating unit is a gap plus a baluster, so dividing the run by that unit and rounding down gives the count. With N balusters there are N+1 gaps to fill, so the actual even gap is the leftover space split N+1 ways.

The 4-inch gap is the whole rule

US codes require that a 4-inch sphere cannot pass between balusters, so the clear gap must stay below 4 inches. Design to about 3.5 inches to leave a safety margin. The gap is measured edge to edge, not center to center.

Code limit (sphere)4.0 in
Safe target gap3.5 in

Anything at or below the shaded target passes inspection with room to spare; a gap that creeps to 4 inches or more fails.

Laying it out evenly

  • Gap vs spacing. Center-to-center spacing = clear gap + baluster width. Only the gap is checked against the 4-inch rule.
  • Fix an oversized gap by adding one. If your rounded count leaves a gap over the limit, add a baluster — more balusters shrink every gap.
  • Split the remainder for symmetry. Spreading the leftover space across all N+1 gaps keeps the end gaps matching the middle, which looks right and inspects clean.
  • Height too. A guard usually needs to be at least 36 inches tall for stairs and decks; spacing alone is not the whole code check.

Common questions

What is the maximum gap between balusters?

US code (IBC and IRC) uses the 4-inch sphere rule: no opening may let a 4-inch ball pass through, so the clear gap between balusters must stay under 4 inches. That is the child-safety limit, and it is a clear gap, not a center-to-center spacing.

How many balusters do I need?

Take the railing length between posts, divide by the sum of one gap plus one baluster width, and round down. That count guarantees the gap never exceeds your target. More balusters means smaller gaps, so add one if the last gap comes out over 4 inches.

Is spacing measured between centers or between edges?

The safety limit is the clear gap between the edges of neighboring balusters. Center-to-center spacing equals that gap plus one baluster width, so do not confuse the two when you check against the 4-inch rule.

From the blog

Guides & how-tos

All articles →