The International Residential Code (IRC) requires that openings in deck railings be small enough that a 4-inch sphere cannot pass through. Getting baluster spacing right means your deck passes inspection and keeps kids and pets safe — while avoiding the cost of buying too many balusters or the headache of ripping them out and starting over.
Enter your span and baluster size to get the exact count and gap.
What the code requires
The relevant code is IRC Section R312.1.3 (guards). The key requirements:
- The 4-inch rule: No opening in a guard (railing) shall allow passage of a sphere 4 inches in diameter. This means the clear gap between balusters must be less than 4 inches.
- Where it applies: Decks, balconies, porches, stairs, landings, and ramps that are more than 30 inches above grade.
- Guard height: Minimum 36 inches for residential decks (42 inches for commercial and some jurisdictions).
- Stair guards: The same 4-inch rule applies to balusters along staircases, measured between the stair nosing and the bottom rail as well.
Important: Local jurisdictions can and do amend the IRC. Some areas require 3.5-inch maximum openings or taller guard heights. Always check with your local building department before starting work.
How to calculate spacing
Here's the step-by-step process with a worked example.
Given: 72-inch span between posts, 1.5-inch wide balusters (standard 2×2 stock).
Step 1: Determine minimum balusters
Divide the total span by the maximum spacing unit (one baluster width + one maximum gap):
72 ÷ (1.5 + 4) = 72 ÷ 5.5 = 13.09
Round up: you need at least 13 balusters.
Step 2: Calculate actual gap
With 13 balusters in a 72-inch span, there are 14 gaps (one on each side of each baluster, plus the gaps between the end balusters and the posts).
Total baluster width: 13 × 1.5 = 19.5 inches
Remaining space: 72 − 19.5 = 52.5 inches
Gap size: 52.5 ÷ 14 = 3.75 inches
Step 3: Verify compliance
3.75 inches is less than 4 inches. A 4-inch sphere will not pass through. This layout is code-compliant.
Installation tips
- Make a spacer block. Cut a scrap to the exact gap width (3.75" in our example). Use it to position every baluster consistently. This is faster and more accurate than measuring each one.
- Start from one end. Place your first baluster with the spacer against the post, fasten it, then work across. Any accumulated error shows up at the far end where you can adjust the final gap.
- Pre-drill your holes. Balusters split easily, especially near the ends. Pre-drill pilot holes for screws or nails. For hardwood balusters, this is mandatory.
- Check the first and last gap. The gaps between the end balusters and the posts are the ones inspectors check first. Make sure they're equal and compliant.
- Use a level. Check every 4th or 5th baluster for plumb. Small errors compound quickly over a long run.
Common mistakes
Center-to-center vs. clear gap
The code measures the clear opening — the daylight between balusters. If you space balusters at 5.5 inches center-to-center with 1.5-inch balusters, the clear gap is 4 inches. That fails the 4-inch sphere test because 4 inches equals the sphere diameter exactly. You need the gap to be less than 4 inches, not equal to it.
Forgetting post width
Measure the clear span between the inside faces of your posts, not the center-to-center post distance. If your posts are 3.5 inches wide and spaced 8 feet on center, your clear span is 96 − 3.5 = 92.5 inches, not 96.
Manufacturing variation
Balusters from the lumberyard aren't perfectly uniform. A "1.5-inch" baluster might actually be 1.45 or 1.55 inches. If you're cutting it close to the 4-inch limit, measure a sample of your actual balusters and use the narrowest width in your calculation. Better yet, target a gap of 3.5 inches or less for a comfortable safety margin.
Local code differences
Some jurisdictions have stricter requirements than the IRC. California, for example, has seismic and wind considerations that can affect railing construction. Some HOAs impose their own design requirements on top of code. Always pull your local code before finalizing a design.
Enter your span and baluster dimensions. Get the exact count, gap size, and code compliance check.