🟢 Live
ft
Total length of the railing section Enter railing length (1–500 ft)
in
Typical: 1.5 in square or 1.75 in round Enter baluster width (0.5–6 in)
in
IRC code: 4 in max (no sphere > 4 in through) Enter max gap (1–6 in)
Posts divide the run into sections
Balusters Needed
Was this calculator helpful?

How Baluster Spacing Works

Building codes (IRC R316.2) require that no opening in a residential guard railing allow passage of a 4-inch sphere. This means the clear gap between balusters must be 4 inches or less. The calculation distributes balusters evenly within each section between posts.

Spacing Formula
Section length = Total run ÷ (Posts − 1)
Balusters per section = ceil((Section − Gap) ÷ (Width + Gap))
Actual gap = (Section − (N × Width)) ÷ (N + 1)
The goal is to find N (number of balusters) such that the actual gap is as close to the max as possible without exceeding it. The result distributes spacing evenly across the section.
💡 Code note: Stair railings require the 4-inch sphere test for the angled gaps between stair balusters, which are typically tighter than flat deck railings. Some jurisdictions require 4” max for decks and 4” measured perpendicular to the stair rake for stairs.
Frequently Asked Questions
The International Residential Code (IRC) requires that balusters be spaced so that a 4-inch sphere cannot pass through any opening. This applies to guards (railings on decks and stairs over 30 inches high). Some jurisdictions adopt stricter local codes, so always verify with your local building department.
Start with the total section length between posts. Subtract the number of balusters times their width, then divide by one more than the number of balusters to get the gap. Adjust the count until the gap is just under 4 inches. Our calculator does this automatically and gives you the exact on-center spacing to mark on your rail.
On-center (OC) spacing is measured from the center of one baluster to the center of the next. It equals the baluster width plus the clear gap. For a 1.5-inch baluster with a 3.5-inch gap, OC spacing = 5 inches. Mark your rail at 5-inch intervals starting from the post face plus half the gap.
A common rule of thumb is 2–3 balusters per linear foot of railing with standard 1.5-inch square balusters and a 4-inch max gap. At exactly 4-inch gaps with 1.5-inch balusters, OC spacing = 5.5 inches, giving approximately 2.2 balusters per foot. Our calculator gives the exact count for your specific dimensions.
The IRC requires balusters spaced no more than 4 inches apart — close enough that a 4-inch sphere cannot pass through (child safety). Measure clear spacing edge-to-edge, not center-to-center. Round spindles may require tighter spacing since the minimum clear gap is between the widest points. Always verify with your local building department for any jurisdiction amendments.
Best for exterior: aluminum (rust-proof, zero maintenance), composite (weather-resistant, matches composite decking), stainless cable (modern look, very durable), and pressure-treated wood (lowest cost, requires sealing). Avoid standard untreated wood balusters in wet conditions — they rot quickly. Metal balusters cost more upfront but require virtually no maintenance.
Related Calculators