Enter your railing's total length, baluster width, and the maximum code-allowed gap to get an exact baluster count and evenly split spacing.
Estimate only — check your local code's exact max-gap requirement before building.
We find the smallest number of balusters where the leftover space, split evenly into gaps on both sides of every baluster, stays at or under your code's max gap — then we show the actual resulting gap so it's evenly balanced across the whole railing rather than crowded at one end.
Most US residential codes require gaps small enough that a 4 in sphere can't pass through — check your local building department, since some jurisdictions use a stricter standard.
Real-world railings rarely divide evenly into whole 4 in gaps, and inspectors check the actual built gap — spacing slightly under 4 in and splitting evenly avoids failing inspection over a fraction of an inch.