Free calculator
Baluster Spacing Calculator: Even Spacing That Passes Code
Baluster counts and perfectly even gaps for level and stair railings - every layout checked against the 4-inch sphere rule. No sign-up; the math runs entirely in your browser.
By Basharat Ali, FounderCalculation reviewedUpdated October 2026
feet, post to post
inches (2x2 = 1.5)
inches (code: 4)
You need
18 balusters
Even spacing between balusters
3.63″
4-inch sphere rule
Passes
Steps: 96″ total ÷ (1.5″ baluster + 4″ max gap) → 18 balusters, evenly spaced at 3.63″ on center gaps.
Estimated cost
What will it cost?
Enter your local store prices — prices vary by region.
Balusters
18 balusters
—
Estimate — prices vary by store and region. Check your local store for current pricing.
Worked example: 8-ft deck railing
Full arithmetic, step by step (2x2 balusters = 1.5 in, 4-in max gap):
- Total inches: 8 × 12 = 96″
- Baluster count: floor((96 + 4) ÷ (1.5 + 4)) = floor(18.18) = 18 balusters
- Even gap: (96 − 18 × 1.5) ÷ 19 = 69 ÷ 19 = 3.63″ - under 4″, passes code
End gaps match the middle gaps, so the railing looks symmetric - that's the whole point of computing from the count instead of guessing.
The formulas
Baluster count
n = ⌊ (total inches + max gap) ÷ (baluster width + max gap) ⌋ - the largest count that still fits within the max gap.
Even spacing
gap = (total inches − n × baluster width) ÷ (n + 1) - the +1 accounts for the gaps at both ends.
Frequently asked questions
What is the 4-inch sphere rule for railings?
Most US building codes (IRC) require that a 4-inch-diameter sphere cannot pass through any opening in a guard railing. That means gaps between balusters must be under 4 inches everywhere - this calculator checks your even spacing against that limit and flags failures.
How do you space balusters evenly?
Divide the total run by (baluster width + max gap), round down to get the baluster count, then recompute the real gap: (total length − balusters × width) ÷ (balusters + 1). The leftover space distributes evenly, including both ends. The calculator does this in one step.
How many balusters do I need for an 8-foot railing?
With standard 2x2 balusters (1.5 in actual): floor((96 + 4) ÷ (1.5 + 4)) = floor(18.18) = 18 balusters, evenly spaced at 3.63-inch gaps - the largest count whose spacing stays under 4 inches. Always fit the count to the code, never round down to save balusters.
What is the actual width of a 2x2 baluster?
1.5 inches. Like all dimensional lumber, a nominal 2x2 is 1.5 × 1.5 inches actual. The calculator defaults to 1.5 - change it if you're using turned, metal, or cable-style balusters with a different width.
How do you space balusters on stairs?
Use the stair's horizontal run length and the same even-spacing math - switch the calculator to stair mode. Note that many inspectors separately check the triangular openings where balusters meet treads against the 4-inch (sometimes 6-inch) sphere rule, so verify with your local code.
Does this work for cable railing?
No - this calculator is for picket/baluster railings where each baluster has a fixed width. Cable railing spacing follows different rules (cable deflection under load matters as much as spacing), so use the manufacturer's spec for those systems.
Keep estimating