Deck Railing Height & Baluster Spacing: The Code Guide

By RugCalc Editorial Team · Last updated: 2026-10-14 · 6 min read

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.

Doing the layout now? Use the deck railing spacing calculator — enter rail length and baluster width for exact counts and even gaps.
Deck railing with balustersRailing height 36 in and baluster gaps under 4 ingap < 4 in36 in mindeck 30 in above grade → guard rail required

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.

Worked example: 120-in rail, 1.5-in balusters, 4-in target gap: 120 ÷ 5.5 = 21.8 → 22 balusters → actual gap = (120 − 22×1.5) ÷ 23 = 3.78 in. Passes the 4-in test comfortably. Check with the deck railing spacing calculator for your rail length.

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

Inspection failures to avoid

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.