Calculate the optimal number of balusters and spacing for code-compliant railings. Ensures compliance with the 4-inch sphere rule (IRC R312.1.3).
Calculate baluster spacing for code-compliant railings
Measuring Tips
Measure the clear span between the inside edges of your posts. This is the area that will be filled with balusters. Do not include the post widths in this measurement.
Formula
Gap = (Total Width - (Balusters × Baluster Width)) / (Balusters + 1)The 4-inch sphere rule (IRC R312.1.3) requires that gaps between balusters must not exceed 4 inches to prevent children from getting their heads stuck.
| Span | Balusters | Gap | Compliant |
|---|---|---|---|
| 24" | 5 | 3.25" | ✓ Yes |
| 30" | 6 | 3.43" | ✓ Yes |
| 36" | 8 | 3.33" | ✓ Yes |
| 42" | 9 | 3.45" | ✓ Yes |
| 48" | 10 | 3.55" | ✓ Yes |
| 60" | 13 | 3.54" | ✓ Yes |
| 72" | 15 | 3.56" | ✓ Yes |
| 96" | 20 | 3.57" | ✓ Yes |
* Based on 1.5" (2×2 lumber) balusters with 4" maximum gap
The 4-inch sphere rule is based on the average head size of young children. By ensuring that a 4-inch sphere cannot pass through any opening, the code prevents children from getting their heads stuck between balusters, which could lead to strangulation or injury.
Minimum Balusters = ⌈(Span - Max Gap) ÷ (Baluster Width + Max Gap)⌉
Actual Gap = (Span - (Balusters × Width)) ÷ (Balusters + 1)
Where Max Gap is 4 inches per building code.
IRC R312.1.3
International Residential Code section covering guard openings. Requires that openings shall not allow passage of a sphere 4 inches in diameter.
Local Codes
Some jurisdictions have stricter requirements. Always verify with your local building department before construction.
The 4-inch sphere rule (IRC R312.1.3) is a building code requirement that states a 4-inch diameter sphere cannot pass through any opening in a guard or railing. This is designed to prevent children from getting their heads stuck between balusters. The gap between balusters must be less than 4 inches.
The gap (or clear spacing) is the actual open space between balusters - this is what the building code measures. Center-to-center spacing is the distance from the center of one baluster to the center of the next, which includes half of each baluster's width. For installation, center-to-center is often easier to mark.
Measure from the inside edge of one post to the inside edge of the other post. This is the clear opening that will be filled with balusters. Do not include the post widths in this measurement.
The most common baluster sizes are 2×2 lumber (1.5" actual) for wood railings and 3/4" to 1" for metal balusters. Larger balusters require fewer pieces but may look bulkier. Smaller balusters create a more open feel but require more pieces.
The 4-inch sphere rule applies to guards and railings in residential construction under the International Residential Code (IRC). Commercial buildings may have different requirements. Always check your local building codes as they may be more restrictive.
The gap between the posts and the first/last balusters must also comply with the 4-inch rule. This calculator ensures even spacing throughout, including the end gaps, so all openings are code-compliant.