Key takeaways
- Gap = (rail length − balusters × width) ÷ (balusters + 1).
- The IRC's opening rule is that a 4-inch sphere must not pass, so keep a margin.
- A guard can be triggered 36 inches out from the edge, so a yard that slopes away matters.
Enter the clear distance between posts, your baluster's width, and the largest gap you want. We default to 3 3/4 inches to leave a margin under the IRC's 4-inch rule.
How the calculator works
- Balusters: the smallest whole number where (rail − count × width) ÷ (count + 1) is at or under your target
- Equal gap: (rail − count × width) ÷ (count + 1)
Worked example
A 96-inch section with 1 1/2-inch balusters and a 3 3/4-inch target:
- 18 balusters take 27 inches
- 69 inches remains, split into 19 gaps
- Each gap is about 3.63 inches
To lay it out, mark the center of the rail and work out from there, or make a spacer block the size of your gap.
When a deck needs a guard
The 2021 IRC calls for a guard on open-sided walking surfaces more than 30 inches above the floor or grade at any point within 36 inches horizontally of the edge.
So you can't just measure at the house. If the yard falls away, measure down from the deck 36 inches out from every open side. A deck that's 26 inches at the house can be over 30 inches a short way out.
Guard figures
| Item | 2021 IRC figure | Section |
|---|---|---|
| Height at decks | At least 36 in | R312.1.2 |
| Height on open sides of stairs | At least 34 in from the nosing line | R312.1.2 |
| Opening | A 4 in sphere must not pass | R312.1.3 |
| Open side of stairs | A 4 3/8 in sphere must not pass | R312.1.3 |
| Stair triangle | A 6 in sphere must not pass | R312.1.3 |
| Load on guards | 200 lb concentrated | Table R301.5 |
| Load on in-fill | 50 lb | Table R301.5 |
The 2024 IRC moved guards to Section R321.1, and the core numbers we compared are the same. Check what your area has adopted.
Why spacing isn't enough
Equal gaps don't make a guard strong. Loads are carried by the posts, their connection to the framing, and the rails. Section R507.10.2 says 4 × 4 guard posts must not be notched at the support connection. For post attachment, follow your local code, a hardware maker's tested details, or an engineer's design.
Rails also bow over a long span, which can open up a gap. That's the reason for the margin, and a longer section is a reason to check for it.
Frequently asked questions
How far apart should balusters be?
Close enough that a 4-inch sphere can't pass through, under the IRC. Many builders aim a bit tighter, and our tool defaults to 3 3/4 inches.
How many balusters for an 8-foot section?
With 1 1/2-inch balusters and a 3 3/4-inch maximum gap, 18 balusters give gaps of about 3.63 inches.
Does a low deck need a railing?
Under the 2021 IRC, it depends on the 30-inch measure within 36 inches of the edge. Your local rules may differ, so ask your building department.
Sources
We use primary sources where we can: building codes, federal rules and manufacturer documents. Read our editorial standards.
- 2021 International Residential Code, Chapter 3, Sections R301.5 and R312.1
- 2021 International Residential Code, Chapter 5, Section R507.10.2
- 2024 International Residential Code, Chapter 3