JusTheToolPRECISION CALCULATORS

🚧 Baluster Spacing Calculator

Quick answer: Balusters must be spaced so a 4-inch sphere can't pass between them. Divide the rail length by (baluster width + 4 in) and round up for the count, then space them evenly.

Enter the opening between your posts and the baluster width to get an even spindle layout that keeps every gap under the 4-inch code limit.

Published by Muhammad Ahmad · Formulas derived from published code tables and manufacturer specifications
See our methodology

US code: gap must be < 4 in

Baluster Layout

BALUSTERS
13
EVEN GAP
3.75 in
ON-CENTER SPACING
5.25 in
CODE CHECK
PASS
Layout starts and ends with a gap against each post, keeping every opening under the limit.

How Baluster Spacing Is Calculated

Building code (IRC R312) says a 4-inch sphere must not pass through any opening in a guard, so every gap between balusters — and between a baluster and a post — must be less than 4 inches. Even spacing means the pattern reads gap, baluster, gap, baluster, …, gap, so there is always one more gap than there are balusters. The formula that finds the smallest baluster count meeting the limit is:

Balusters = ceil((opening − max gap) ÷ (baluster width + max gap))

Once the count is set, the calculator solves for the exact even gap: (opening − balusters × baluster width) ÷ (balusters + 1). That guarantees an evenly spaced railing that passes inspection.

Measure the true openingUse the clear distance between the posts (or between newels), not the post centers. If your run turns a corner or has a mid-span post, calculate each section separately.

Why you calculate from the gap, not the balusters

The instinct is to divide the railing into equal parts and place a baluster in each. That fails inspection, because the code does not regulate baluster spacing — it regulates openings. IRC R312.1.3 states that a 4-inch sphere must not pass through any opening in a guard. An even division that leaves 4⅛ in at the ends fails even if every interior gap is perfect.

So the arithmetic runs backwards from the limit: decide the maximum gap you will accept (most builders target 3¾ in to leave tolerance), then find the smallest number of balusters that keeps every opening — including the two against the posts — at or below it. That almost never divides evenly, which is why the correct answer usually has slightly smaller gaps than the maximum.

Build in tolerance. Target 3½–3¾ in rather than a theoretical 3.99 in. Wood moves, posts are rarely perfectly plumb, and an inspector's ball does not care about your spreadsheet. A gap designed at the limit will exceed it somewhere along the run.

The other code numbers on the same railing

RequirementResidential (IRC)
Guard required when walking surface is above30 in from grade
Minimum guard height, decks36 in
Maximum opening in a guard4 in sphere
Opening at open stair riser4 in sphere
Triangle at tread, riser and rail bottom6 in sphere
Guard load resistance200 lb concentrated, any direction

The 6-inch triangle rule is the one people miss on stairs. At the bottom of a raked guard, the space bounded by the tread, the riser, and the bottom rail is allowed a larger sphere than the 4 in that applies everywhere else — but only that specific triangle.

Stair rails: measure along the rake

On a sloped run, the 4-inch rule is applied perpendicular to the rail, not vertically. That means baluster spacing measured along the rake is what governs, and it produces a slightly different count from the level section it connects to. Lay out and measure along the slope; do not carry the deck spacing onto the stairs.

Common layout mistakes

Frequently Asked Questions

How far apart should deck balusters be?

Close enough that no gap exceeds 4 inches. For 1.5-inch balusters that usually means roughly 5 to 5.25 inches on center, giving an even gap just under 4 inches.

What is the 4-inch rule for railings?

Guards must not allow a 4-inch sphere to pass through, which protects small children. This tool sizes the gap to stay under that limit automatically.

How do I space balusters evenly?

Divide the opening by the maximum spacing to get the count, then recompute the exact gap so all spaces are equal. Starting and ending with a gap against each post keeps it symmetrical.

Do the gaps at the posts count?

Yes. The space between the end baluster and the post must also be under 4 inches. This calculator includes those end gaps in the layout.

🔗 Related Tools You Might Need

More decking, fencing & siding tools

→ All 8 decking, fencing & siding calculators

Last reviewed August 2026 · how we source these figures

Sources for the figures on this page

Every constant this calculator uses and where it comes from, so you can check it rather than take our word for it.

Local codes amend the model IRC and adopt different cycles — your building department governs. Manufacturers revise yields; where your product's data sheet disagrees with a default here, use the product's number. See our full methodology.