How it works
- Balusters = (opening − largest gap) ÷ (baluster width + largest gap), rounded up
- Gap = (opening − balusters × baluster width) ÷ (balusters + 1)
- Center to center = gap + baluster width
Rounding up gives the fewest balusters that keep every gap at or under your limit. The gaps next to the posts are the same as the gaps between balusters, so the section looks even.
Example: a 72 inch opening with 1.5 inch balusters and a 3.5 inch limit. (72 − 3.5) ÷ (1.5 + 3.5) = 13.7, so 14 balusters. Gap = (72 − 14 × 1.5) ÷ 15 = 3.4 inches, which is 3 3/8 in.
Laying it out
- Measure each opening on its own. Posts are rarely the same distance apart.
- Mark the center of the first baluster from the post, using the post to first center number.
- Step off the center to center distance for the rest. Marking all the centers from one end with a tape avoids small errors adding up.
- Cut a scrap block to the gap width and use it as a spacer while you fasten.
The 4 inch rule
The International Residential Code says a 4 inch ball must not fit through any opening in a deck guard rail. So the clear gap has to be less than 4 inches. Many builders aim for 3.5 inches to leave room for boards that warp or shrink. The rail along the open side of a stair is allowed slightly wider gaps, up to a 4 3/8 inch ball.
Common questions
What is the code for baluster spacing on a deck?
Under the International Residential Code, a 4 inch sphere must not pass through any opening in the guard, so gaps must be under 4 inches. A guard is required when the deck is more than 30 inches above the ground, and it must be at least 36 inches tall. Some states and cities require a taller rail.
How many balusters do I need per foot?
About 2.4 per foot with 1.5 inch balusters and a 3.5 inch gap, so roughly 14 for a 6 foot section. The calculator gives the exact count for your opening.
What is the on-center spacing for 2x2 balusters?
With a 3.5 inch gap it is 5 inches. The calculator usually lands a little under that, because it evens out the gaps to fit your opening exactly.
Should the gap next to the post match the others?
Yes, that looks best and it is what this calculator gives you. Every gap, including the two at the posts, is the same size.
Put this calculator on your site
Paste this code into any web page to show the calculator there. It is free to use.
Sources
- International Residential Code 2021, Chapter 3: stairs (R311.7) and guards (R312)
- American Wood Council, DCA 6: Prescriptive Residential Wood Deck Construction Guide
Facts on this page were last checked against these sources in October 2026.