Deck Baluster Spacing Calculator
Building code requires that deck railing openings not allow a 4-inch diameter sphere to pass through (IRC R312.1.3). This means the clear gap between balusters must be less than 4 inches. This calculator finds the number of balusters needed for even spacing while keeping all gaps below the maximum. It uses the formula: Balusters = ceil((Railing length - baluster width) / (max gap + baluster width)), then recalculates the actual even spacing. The result shows the baluster count and the actual gap, both of which must pass the 4-inch sphere test.
Baluster spacing formula
Balusters = ceil((Railing length - baluster width) / (max gap + baluster width))
Actual gap = (Railing length - (balusters + 1) x baluster width) / (balusters + 1)
The ceil function ensures the gap is never wider than the maximum. The actual gap is recalculated after rounding up to find the true even spacing between balusters. Always verify the actual gap is less than 4 inches before installation.
IRC guardrail requirements
- Guardrails required when deck surface is more than 30 inches above grade (IRC R312.1.1).
- Minimum guardrail height: 36 inches (IRC R312.1.2).
- Openings must not allow a 4-inch sphere to pass through (IRC R312.1.3).
- Bottom rail opening must not allow a 4-inch sphere to pass between the deck and bottom of guardrail.
- Guardrails must resist a 200-pound horizontal load at any point per IRC R312.1.5.
Baluster spacing calculator: frequently asked questions
What is the maximum gap between deck balusters?
Per IRC Section R312.1.3, openings in guardrails must not allow a 4-inch sphere to pass through. This means the clear gap between balusters must be less than 4 inches. In practice, balusters are spaced at 3.5 to 4 inches on center minus baluster width.
How do I calculate the number of balusters needed?
The formula is: Balusters = floor((Railing length - baluster width) / (gap + baluster width)). This ensures the first and last balusters are at the posts, and every gap is equal and less than 4 inches.
What is the minimum guardrail height for a deck?
Per IRC R312.1.1, guardrails are required on decks more than 30 inches above grade. The minimum height is 36 inches for decks less than 30 inches above grade, and 36 inches for most residential decks. Some jurisdictions require 42 inches.
How do I space balusters evenly across the full railing run?
Calculate the number of bays (spaces) by rounding up baluster count, then recalculate the actual spacing: Actual spacing = (Railing length - (balusters + 1) x baluster width) / (balusters + 1). This divides remaining space evenly.
Do I need a baluster at the start and end of each section?
Typically the posts serve as the start and end anchors. Balusters fill the space between posts. The calculation treats post-to-post as one section. Measure inside post to inside post for best results.
Official sources
- International Code Council: IRC Section R312 Guards (Guardrails).
- American Wood Council: DCA6 Prescriptive Residential Wood Deck Construction Guide.
Reviewed by the CalculatorHub team, edited by James Graham, 15 June 2026. See our methodology.