Deck Railing Height & Baluster Spacing: The Code Guide
Quick answer: a deck 30 in or higher needs a guard rail 36 in tall, and balusters must be spaced so a 4-inch sphere cannot pass through. A 10-ft rail with 1.5-in balusters takes 22 balusters at ~3.8-in gaps.
Railing height: 36 or 42 inches
The moment your deck surface is 30 inches above grade, residential code (IRC) requires a guard rail. The standard minimum is 36 inches measured from the deck surface to the top of the rail. Decks on upper stories — typically 3+ floors — need 42 inches in many jurisdictions.
Before you build, call your local building department or read your county's amendments. A surprising number of areas keep 42 inches for everything, and the inspector's tape wins every argument.
The 4-inch sphere rule
The spacing rule is simple to remember: a 4-inch sphere must not pass through any opening in the railing — between balusters, under the bottom rail, or under the railing itself. That's a head-entrapment safety measure, and inspectors literally test it with a 4-in ball.
Openings include the gap under the bottom rail. If your decking creates a gap above 4 in, a horizontal infill board or extended balusters close it.
Counting balusters
Baluster count = rail length ÷ (baluster width + gap), rounded up, plus 1. For a 120-in rail, 1.5-in balusters and a 4-in gap: 120 ÷ 5.5 = 21.8 → 22 balusters, which lands at a slightly under-4-in actual gap.
The exact math matters because baluster widths vary (1.5 in standard, 2 in turned styles, 5/4 deck boards). If you mix widths, treat each section separately.
Even layout without math pain
Set the centerline of each baluster, not its edge. Take the rail length, subtract one baluster width, divide by the number of spaces (balusters + 1), and mark every space from a single end. Use a story pole — a marked board you can clamp and reuse — so every rail on the deck matches.
Posts and load rules
- Posts must resist 200 lb of concentrated load at the top rail (or 50 lb/ft distributed).
- Notch or bolt posts to the rim joist with approved connectors — lag screws into the decking don't pass.
- Horizontal rails below 34 in above the deck surface must not create a climbing ladder (no more than one such rail).
Inspection failures to avoid
- One baluster too few — the 4-in sphere test fails and every post hole gets re-drilled.
- Uneven gaps — measure from one end; eyeballing three feet in always drifts.
- Lag-screwed posts — use through-bolts or rated connectors to the framing.
- 36-in rail measured wrong — measure to the top of the gripping surface, not the post cap.
- Skipping the opening check — the gap under the bottom rail is part of the sphere test.
Build it right the first time
Run your rail length through the deck railing spacing calculator before you buy balusters — it returns the count and the exact even gap. Then confirm height and posts with your local code. A code-passing deck on the first try is worth the five minutes.