... LIVE
Enter a valid run length (0.5–500 ft).
Measure from outside face of first post to outside face of last post
Enter baluster width (0.5–6 inches).
2×2 wood = 1.5″ actual  |  Wrought iron = 0.5″–1″  |  Measure actual, not nominal
Enter max gap (1–6 inches).
IRC code max = 4″  |  Recommended: 3.5″–3.75″ for safety margin
Posts at each end + any intermediate posts
4×4 post = 3.5″ actual  |  6×6 = 5.5″ actual
Stairs: IRC allows 4-3/8″ sphere at stair rake
Balusters Needed

Sources & Methodology

Spacing formulas and code compliance checks are based on the International Residential Code (IRC) Section R312, which establishes the 4-inch sphere rule for guardrail openings in residential construction.
📜
International Residential Code (IRC) — Section R312: Guards
The primary code source for guardrail height requirements, baluster opening limits, and the 4-inch sphere rule for residential construction
📐
Inch Calculator — Baluster Calculator Reference
Industry-standard baluster spacing formula verification: count = run ÷ (baluster width + gap), with rounding and post deduction methodology
🏗️
Engineer Fix — Baluster Spacing Code Requirements
Detailed explanation of IRC and IBC sphere rule application for deck and stair railings, including stair triangle opening rules
Formulas: Usable Run = Total Run (inches) − (Posts × Post Width). Count = ceil(Usable Run ÷ (Baluster Width + Max Gap)). Actual Gap = (Usable Run − Count × Baluster Width) ÷ (Count + 1). On-Center = Baluster Width + Actual Gap. Code check: Actual Gap ≤ 4.0″ (IRC deck) or ≤ 4.375″ (IRC stair rake). Order quantity = Count + 10% waste.

⏱ Last reviewed: April 2026

How to Calculate Baluster Spacing (IRC Code Compliant)

Baluster spacing is one of the most critical measurements in deck and stair construction. Get it wrong and you fail inspection. Get it right and you have a safe, visually uniform railing that passes the building inspector’s 4-inch ball test on the first try. The formula is straightforward once you understand that the goal is to make every gap identical — not just within code, but perfectly even from the first baluster to the last.

The International Residential Code (IRC) Section R312 mandates that no opening in a residential guardrail can allow a 4-inch diameter sphere to pass through. This rule protects children from falling through or getting stuck. Most experienced builders target 3.5–3.75 inches — slightly inside the 4-inch limit — to account for wood movement, installation tolerances, and the fact that an inspector’s 4-inch ball barely fits through a 4.00-inch gap.

The Baluster Spacing Formula Step by Step

Count = ceil((Run_inches − Posts × PostWidth) ÷ (BalWidth + MaxGap))
Then: Actual Gap = (Usable Run − Count × BalWidth) ÷ (Count + 1)
On-Center = BalWidth + Actual Gap

Worked example: 10 ft railing, 2 posts (3.5″ each), 1.5″ balusters, 4″ max gap
Usable run = 120 − 7 = 113 inches
Count = ceil(113 ÷ 5.5) = ceil(20.54) = 21 balusters
Actual gap = (113 − 21 × 1.5) ÷ 22 = (113 − 31.5) ÷ 22 = 81.5 ÷ 22 = 3.70 inches ✓ passes code
On-center = 1.5 + 3.70 = 5.20 inches

IRC Baluster Code Requirements by Location

LocationMax GapMin HeightIRC Reference
Deck / Level Guard4.0″36″ (decks <30″ high)
36″+ (decks ≥30″)
IRC R312.1
Stair Rake (between balusters)4.375″ (4-3/8″)34″–38″ from nosingIRC R311.7.8
Stair Triangle Opening6″ sphereIRC R311.7.8.2
Commercial (IBC)4.0″42″IBC 1015.3
Pool Fencing4.0″48″ minimumIRC R326

Common Baluster Widths by Material

Material / StyleNominal SizeActual WidthNotes
2×2 Wood2″ × 2″1.5″Most common for wood decks
5/4 Wood5/4″1.0″Thinner profile, more balusters needed
Square Metal (aluminum)1″ sq1.0″Standard aluminum railing
Round Iron (wrought)1/2″ dia0.5″Traditional iron spindles
Flat Iron Bar3/4″0.75″Modern steel flat bar style
Composite 2×22″ × 2″1.5″Same as wood 2×2 nominal
💡 Pro tip: Always use the actual measured width of your baluster, not the nominal lumber size. A “2×2” wood baluster actually measures 1.5 inches. Using the wrong width throws off your spacing calculations enough to fail inspection. For turned or decorative spindles that taper, use the widest measurement to ensure code compliance at the thickest point.
Frequently Asked Questions
Count = ceil((Run − Posts × PostWidth) ÷ (BalWidth + MaxGap)). Then: Actual Gap = (Usable Run − Count × BalWidth) ÷ (Count + 1). For a 10 ft railing with 2 posts at 3.5″ each, 1.5″ balusters at 4″ max gap: Usable = 113″, Count = 21 balusters, Actual gap = 3.70″. Use this calculator for instant results on any dimensions.
As a rough estimate, most deck railings use about 3 balusters per linear foot using 1.5″ balusters at the 4″ IRC maximum gap. For tighter 3.5″ gaps, expect about 3.2 per foot. For thin wrought iron (0.5″) at 4″ gaps, about 2.7 per foot. Always use the exact formula for precision — these are planning estimates only.
IRC requires a maximum 4-inch clear gap between balusters on level deck railings (the 4-inch sphere rule). On stair rakes, the IRC allows up to 4-3/8 inches (4.375″) between balusters due to the angle. The triangular opening at a stair tread allows up to 6 inches. Local amendments may be stricter — always verify with your local building department.
The 4-inch sphere rule (IRC R312) states no opening in a guardrail can allow a 4-inch diameter sphere to pass through. It’s a child safety requirement preventing small children from getting their heads stuck or falling through gaps. Building inspectors may literally use a 4-inch ball to test compliance. Most builders target 3.5–3.75″ for a safety margin.
On-center spacing is the distance from the center of one baluster to the center of the next. It equals baluster width plus clear gap. For 1.5″ balusters at a 3.70″ gap, on-center = 5.20″. On-center spacing is used to mark installation positions during framing. Simply mark the first center, then step off by the on-center measurement using a tape measure.
Deck railing posts should be spaced no more than 6–8 feet apart. Most codes allow up to 8 feet maximum on-center for residential decks. For elevated decks, wind-exposed areas, or premium aesthetics, 6-foot post spacing provides better rigidity. Post spacing directly affects the railing’s ability to withstand the 200 lb lateral load required by IRC.
Standard 2×2 wood balusters measure 1.5 inches (dimensional lumber actual size). Aluminum balusters are commonly 1 inch square. Wrought iron round spindles are 0.5–0.75 inch diameter. Thicker balusters require fewer pieces to fill a span but create a heavier visual look. Always use the actual measured width — not the nominal lumber size — in your calculations.
Yes. Posts physically occupy space in the railing run. Subtract total post width from your railing length before calculating baluster count. For 2 posts at 3.5″ each on a 10-foot railing: usable run = 120 − 7 = 113 inches. Skipping this step causes your end gaps to differ from your middle gaps and can push the first or last gap over 4 inches.
For a 10-foot (120″) railing with 2 posts (3.5″ each), 1.5″ balusters, and 4″ max gap: usable run = 113″. Count = ceil(113 ÷ 5.5) = 21 balusters. Actual gap = 3.70″. Order 23–24 balusters (add 10% waste for breakage and cuts). On-center spacing = 5.20″.
IRC requires a minimum 36-inch guardrail height for residential decks. Some jurisdictions require 42 inches for decks 30 inches or more above grade. Stair handrails must be between 34 and 38 inches measured vertically from the tread nosing. Commercial buildings (IBC) require 42 inches. Always verify your local code as amendments vary by jurisdiction.
Related Calculators
Popular Calculators
🧮

Missing a Construction Calculator?

Can’t find the construction calculator you need? Tell us — we build new ones every week.