Balusters fail inspections for one reason: a gap somewhere drifted past the code maximum. This Spindle Spacing Calculator lays out a railing run exactly — enter the run length between posts, the baluster width and your maximum allowed gap (4 inches under the US residential code’s sphere rule), and get the spindle count, the true even gap and the on-center spacing to mark.







Worked Example: A 96-Inch Deck Rail, 1.5-Inch Balusters

The layout solves for the smallest baluster count that keeps every clear gap at or under 4 inches. With n spindles of width w there are n + 1 clear gaps (one at each end against the posts), so the requirement (L − n·w) / (n + 1) ≤ 4 becomes n ≥ (L − g) / (w + g) = (96 − 4) / (1.5 + 4) = 16.7, rounded up to 17 spindles. The true gap is then (96 − 17 × 1.5) / 18 = 70.5 / 18 = 3.92 inches — safely under the limit with every gap identical — and the on-center spacing to mark is gap + width = 5.42 inches. Check the alternative the calculator saves you from: 16 spindles would leave (96 − 24) / 17 = 4.24-inch gaps, a failed inspection hiding in a run that looks evenly spaced. Three marking methods turn the numbers into holes. The on-center method marks each spindle centre at 5.42-inch intervals from the first centre, which sits one gap plus half a spindle (3.92 + 0.75 = 4.67 in) from the post face. The story-pole method transfers all marks to a strip of wood once and reuses it — the professional answer on stairs, where every tread run repeats the layout. And the elastic method (a stretched marked tape or spacer blocks cut to the 3.92-inch gap) trades a little precision for speed on long deck runs. Whichever you choose, lay out the full run dry and sight down it before drilling: equal gaps read as craftsmanship from ten feet away, and a single wandering gap reads as a mistake from the same distance.

The Code Rule Behind the Numbers

The 4-inch figure is not an aesthetic preference — the US International Residential Code (and its counterparts elsewhere) requires that a 4-inch sphere cannot pass through any opening in a guardrail, a rule written around the size of a small child’s head and torso. Two refinements matter at the tape measure. First, the rule binds the worst gap, not the average: a run averaging 3.9 inches with one 4.3-inch gap at a post fails, which is why this calculator enforces the maximum on every gap including the two end gaps against the posts — the ends are where sloppy layouts cheat, and where inspectors look first. Second, stairs add a wrinkle: the triangular opening between tread, riser and bottom rail is governed by a 6-inch sphere exception in the same code, and balusters on a rake (angled) rail must be measured perpendicular to the rail, not vertically, or the true gap is larger than the tape says. Local amendments vary — some jurisdictions and all commercial codes tighten or rearrange these numbers, and pools often add their own rules — so treat 4 inches as the default to verify against your permit, not a universal constant. The calculator takes the maximum gap as an input precisely so the local rule, whatever it is, drops straight into the same arithmetic: the layout math is eternal, only the limit changes.

Stairs, Ramps and Odd Runs

Level runs are the easy case, and the same discipline extends to the harder ones. On stairs, lay out by tread: most builders place two or three balusters per tread, positioned so the perpendicular gap rule holds along the rake — with typical tread runs of 10–11 inches, two 1.5-inch balusters per tread leave gaps that must be checked against the sloped measurement, and three per tread is the usual answer for 2×2 stock on steeper pitches. Measure the run along the rail’s slope and enter that length; the calculator’s arithmetic is indifferent to the angle, but your input must be the sloped length, not the horizontal shadow of it. On ramps the same slope rule applies with the accessibility code’s own guard requirements layered over it. Short returns and corners break the equal-gap assumption: treat each straight segment between posts or corners as its own run with its own layout, because a gap that wraps a corner is measured around it by nobody’s code and looks wrong from everywhere. And for turned or tapered spindles, the width to enter is the width at the widest point the sphere test would meet — usually the turning’s belly — since the code measures the clear opening, and the clear opening is set by the fattest part of the profile.

Thinner Balusters: The Metal-Spindle Version

Run the worked example’s same 96-inch rail with slim half-inch metal balusters and the count, not the rule, changes character: n ≥ (96 − 4) / (0.5 + 4) = 20.4, so 21 spindles, with a true gap of (96 − 21 × 0.5) / 22 = 3.89 inches and an on-center spacing of just 4.39 inches. Two practical consequences follow. First, material cost and drilling time scale with the count — the slim look is bought with holes. Second, very slim balusters flex: a half-inch bar can deflect under a child’s determined push enough to widen a gap locally, which is why inspectors carry the sphere and opinions, and why mid-rails or closer real-world spacing appear on long metal-baluster runs. The calculator’s arithmetic stays correct — it sizes the static gap — but enter the width honestly and consider treating flexible systems with a margin under the limit, an engineering judgment the page can inform but not make. The same logic runs downward to chunky 3.5-inch turned newel-adjacent spindles, where counts fall and each gap’s honesty matters more, because there are fewer of them to average a mistake across.

Two Balusters per Tread: A Stair, Worked

Take a typical residential stair: 10.5-inch tread run, pitch about 37°, so each tread’s length along the sloped rail is 10.5 / cos 37° ≈ 13.15 inches. The classic layout puts two 1.5-inch balusters per tread, dividing that sloped segment into three gaps: (13.15 − 2 × 1.5) / 3 = 3.38 inches — comfortably under the 4-inch limit, which is the arithmetic reason the two-per-tread convention survives. Watch it fail, though, on a shallower stair with longer treads: a 12-inch tread at 33° stretches the sloped segment to 14.3 inches and the same two balusters leave (14.3 − 3) / 3 = 3.77-inch gaps — still passing, but the margin is thinning, and a wider baluster or a longer tread crosses the line into three-per-tread territory. That is the working method for stairs: compute the sloped segment for one tread, test the per-tread count against the gap limit here (enter the segment as the run), and only then repeat the winner up the flight. The stair’s total spindle count is the per-tread decision multiplied by the tread count — and mistakes, on stairs, are likewise multiplied, which is why the tread gets the calculator before the flight gets the drill.

Common Mistakes

Laying out by eye with spacer blocks alone and letting cumulative error pool into the last gap (the calculator’s equal-gap solution exists to prevent exactly this). Measuring stair runs horizontally instead of along the slope. Forgetting the end gaps count — spacing spindles evenly centre to centre across the whole run without accounting for spindle width leaves the end gaps widest, precisely where the inspector measures. Using the spindle’s nominal width instead of its turned maximum. And assuming the 4-inch rule is universal — verify the local code and any pool or commercial overlay before the holes are drilled.

Related Tools

Continue with the Stair Calculator, the Miter Angle Calculator, the Concrete Column Calculator, or browse the full Construction Calculators hub.

Frequently Asked Questions

How do I calculate baluster spacing?

Spindles needed n = (run length − max gap) ÷ (spindle width + max gap), rounded up. Then the true gap = (length − n × width) ÷ (n + 1), and you mark spindles at gap + width on center. For 96 in, 1.5 in balusters, 4 in max gap: 17 spindles at 5.42 in on center.

What is the 4-inch sphere rule?

US residential code requires guardrail openings to reject a 4-inch sphere — no clear gap, including at posts and on stairs (measured perpendicular to a raked rail), may reach 4 inches. It is a child-safety rule; verify your local code’s exact figure.

How many balusters do I need per tread?

Typically two or three. On a 10–11 inch tread with 1.5-inch balusters, two per tread can leave perpendicular gaps near the limit on steep stairs; three is the common safe answer. Lay the stair run out along its slope with this calculator to be sure.

Why are my end gaps bigger than the middle ones?

Because the layout was probably set by equal centre spacing measured post to post, ignoring that the end spaces are clear gaps against flat post faces. The calculator’s method sizes all n + 1 gaps equally — ends included.

Does baluster width mean the widest part?

Yes, for turned spindles — the code measures the clear opening, which the profile’s widest point (usually the belly of the turning) determines. Enter that width.

What if my code allows a different gap?

Enter your jurisdiction’s maximum in the gap field — some commercial codes, pool codes and other countries differ from 4 inches. The layout arithmetic is identical for any limit.