The 4-Inch Rule: Why Baluster Spacing Is a Safety Calculation
Baluster spacing is not a style choice β it is a building code requirement with a child's head as the unit of measurement. The International Residential Code (IRC) requires that a 4-inch sphere must not pass through any opening in a guard railing. The number comes from child safety research: a 4-inch opening is small enough that a small child's head cannot pass through and get trapped. Decks, porches and landings more than 30 inches above grade need guards, and every gap in those guards β between balusters, between the bottom rail and the deck, everywhere β must respect the sphere rule.
In practice, professionals do not aim for exactly 4 inches. Wood moves with humidity, installation is never perfect, and an inspector's tape measure is unforgiving. Most builders target 3.5 to 3.875 inches of clear gap, leaving a margin that absorbs swelling, shrinkage and slightly imperfect cuts. This tool defaults to a 4-inch maximum but computes your actual gap from even distribution β which, done right, lands comfortably under the limit with room to spare.
The Math: Even Gaps From One Formula
The layout problem: distribute balusters across a railing section so every gap is identical and none exceeds the maximum. The method: balusters = round up((length β max gap) Γ· (baluster width + max gap)). Rounding up is the load-bearing step β it guarantees the resulting actual gap comes in under your maximum rather than over it. Then actual gap = (length β balusters Γ width) Γ· (balusters + 1), because balusters divide the opening into one more segment than there are balusters, and on-center spacing = gap + baluster width, which is the number you actually mark with a tape measure.
A worked example: a 72-inch railing section with standard 1.5-inch balusters (a finished 2Γ2) and a 4-inch maximum. Balusters = ceil((72 β 4) Γ· 5.5) = ceil(12.36) = 13. Actual gap = (72 β 19.5) Γ· 14 = 3.75 inches β safely under 4. On-center = 5.25 inches. Mark the first baluster center at gap + half the baluster width from the post face, then every 5.25 inches after that, and the layout lands perfectly even with equal gaps at both posts.
Measure the Right Length
The length in the formula is the clear opening between post faces, not the overall railing length and not the deck edge. Measure inside face to inside face of the posts (or wall) at the height the balusters will sit. Measure twice β a quarter inch of error across a long run shifts every gap. For stair railings, measure the horizontal run, not the distance along the slope: the code gap is measured horizontally, and a gap that looks right along the angled rail can fail when measured level. Stair guards also get a small mercy in the code: the IRC allows up to a 4β -inch sphere on the open side of stair stringers, and a 6-inch sphere in the triangle formed by tread, riser and bottom rail.
Code Presets: US, Stairs, UK and Canada
The tool ships with the common standards built in. IRC residential (US): 4-inch maximum, minimum 36-inch rail height. IBC commercial (US): 4-inch maximum, 42-inch minimum height. Stair open side (IRC): 4β inches. UK and Canada: 100 mm (3.94 inches), minimum 900 mm rail height. These are starting points, not permits β local jurisdictions can and do go stricter, especially for commercial work and multi-family housing. A five-minute call to the local building department before you buy lumber is the cheapest insurance in the project.
Marking the Layout on the Rails
Do the math once, then transfer it to wood. The reliable method: mark the on-center positions on both the top and bottom rails, starting from one post. First center = one gap + half a baluster width from the post face; every center after that = previous + on-center spacing. Use a sharp pencil or a marking knife (knife lines are more precise and guide the saw), and mark an X on the waste side of every line. Work from the same end on both rails so the balusters stand plumb. For long runs, snap a chalk line or clamp a straightedge and transfer all marks at once rather than walking the tape down the rail β cumulative tape-walk error is how the last gap ends up wrong. The tool's marking guide lists every center position for your section so you can work down the list without re-dividing anything in your head.
Buying: The Cut List and Waste Factor
Count every section of railing separately β deck perimeters are rarely one clean run; posts, gates and stairs break them into sections of different lengths, and each section gets its own even layout. The multi-section totalizer in this tool adds them up into one shopping list. Then add 10 percent waste: balusters get miscut, a few arrive twisted, and stain-grade lumber has a reject rate. For fasteners, budget two screws or nails per baluster end (top and bottom), and if you are toe-screwing, pre-drill β splitting a 2Γ2 at the last hole of the day is a rite of passage nobody enjoys twice. Buy all balusters from the same batch and sight down each one before it goes in; a twisted baluster telegraphs through the whole railing line.
Installation Tips From the Field
Install the bottom rail first, level and at the right height above the deck β most codes also limit the opening under the bottom rail to 4 inches, so do not float it high for a "modern look" without checking. Set balusters plumb with a small level every few pieces; a single leaning baluster throws off the eye for the whole run. Work outward from the center of each section toward the posts, or post-to-post with the computed even gaps β either way, dry-fit the whole section before driving fasteners. Leave a hair of clearance (a sixteenth) between baluster ends and rails for expansion, and seal end grain before assembly β end grain drinks water and rots first. If you are staining, stain all six sides of every baluster before installation; the hidden faces are where rot starts.
Common Failures and How to Avoid Them
Uneven end gaps: caused by starting layout from the middle or measuring from the wrong face. Always start from a post face with the computed first-center offset. Gaps creeping over 4 inches: caused by rounding the baluster count down instead of up, or by measuring the full deck length instead of the clear opening. Racking on stairs: balusters cut square for level rails will not sit right on a sloped rail β cut the ends at the stair angle. Ignoring the bottom opening: the 4-inch sphere rule applies under the bottom rail too. Forgetting gates: a gate is a railing section with hinges; its balusters follow the same math, and the latch side needs the same gap discipline.
A final field habit worth adopting: after the last baluster is in, walk the run with a 4-inch ball, a block of wood, or even a soda can (roughly 2.6 inches β well under the limit, a deliberately strict check). If it cannot pass anywhere, neither can an inspector's objection.
When to Call It In
A single straight deck section is a confident DIY project. Call a professional when the railing turns corners with compound angles, when stairs meet landings in three dimensions, when the deck is high enough that a failure means a real fall (anything above about 6 feet deserves extra respect), or when the inspector has already flagged a previous attempt. There is no shame in it β railing is life-safety carpentry, and the code exists because the failure mode is a person falling.