Baluster Spacing Calculator
Even-spacing layout that solves the IRC 2021 R312.1.3 4-inch-sphere rule the right way. Pick a baluster style, enter your railing length, set the section count, and DeckMath returns the exact baluster count, the equal-gap dimension to 1/16″, a side-elevation diagram with dimension lines, and an optional bill of materials with rail kit, brackets, and labor.
Inputs
Railing length
Total perimeter that needs balusters.
A section is the run between two posts. 8.0 ft per section.
Compliance · IRC 2021
Passes IRC R312.1.3 — no 4-inch sphere passes through
IRC R312.1.3Largest gap across all sections: 3 5/8″ (3.64″). IRC R312.1.3 requires every opening in a guard to reject a 4-inch sphere. Your safety target is 3.875″.
36″ rail height — meets IRC R312.1.2 minimum
IRC R312.1.2IRC R312.1.2 minimum guard height is 36″ for one- and two-family residential. 42″ is required in some jurisdictions and recommended on tall decks.
Side-elevation layout
Actual baluster placement with dimension lines — pin next to the saw on cut day.
Section 1 of 4 shown. All sections share identical geometry under equal-section assumption.
Per-section breakdown
Bill of materials
National-median pricing 2026-Q1 · Home Depot / Lowe's / specialty railing suppliers. Labor uses Northeast multiplier (1.22×).
Need a full deck cost?
The Deck Cost Calculator gives you a complete project budget — materials, labor, permits, contingency — across 5 finish tiers.
Layout solves IRC 2021 R312.1.3 (residential guards) using a 3.875″ max-gap target. Stair-side guards use a different rule (R311.7.5.1). Always verify with your local building department before installing. DeckMath is not a substitute for a licensed inspector.
How to use
Three steps. Permit-ready output.
- 01
Measure the railing run
Tape-measure the total length of railing you're building, in linear feet. Add up every section that has balusters — typically the deck perimeter minus the house side (for a ledger-attached deck) or the full perimeter (freestanding).
- 02
Count your sections
A 'section' is the run between two posts. Most decks divide the perimeter into 4-8 ft sections at the corners and any intermediate posts. Count each section once. The calculator divides total length evenly across the count to compute layout per section.
- 03
Pick your baluster style
Wood 2×2 (1.5″ face, classic look, widest gap allowance), wood 1×1 (¾″, modern slim), aluminum square (¾″, powder-coated), aluminum round (5/8″, slimmest sightline), glass panel (no balusters), cable infill (different rule). Each style shows installed price.
- 04
Set the post offset
Distance from the inside face of the post to the centerline of the first baluster. IRC allows up to 4″ here too, but most pros use 2-3″ for visual symmetry. Smaller offset = more balusters = denser look.
- 05
Set the maximum gap
Default is 3 7/8″ (1/8″ safety margin under the IRC R312.1.3 cap of 4″). Some inspectors measure with a sphere that's slightly larger than 4″ in tolerance — the safety margin keeps you well clear.
- 06
Read your layout
PASS/FAIL badge, baluster count per section, equal-gap dimension to 1/16″, side-elevation diagram with dimension lines, and a bill of materials with shop links. Save link, export PDF, embed.
How we calculate
The math, fully transparent.
The Baluster Spacing Calculator solves the IRC 2021 R312.1.3 problem the right way: every gap in a guard system must be small enough that a 4-inch sphere cannot pass through. Enter your total railing length, the number of sections (between intermediate posts), the baluster style and width, and the post offset. DeckMath returns the exact baluster count per section, the equal gap dimension to 1/16″ precision, a PASS/FAIL badge per section against the IRC code, and an optional bill of materials with rail kit, brackets, screws, and labor for any US state. The side-elevation diagram shows the actual layout with dimension lines so you can pin it next to the saw on cut day.
IRC references
- IRC 2021 R312.1 — Guard required when surface is > 30″ above grade
- IRC 2021 R312.1.2 — Minimum guard height 36″ (residential)
- IRC 2021 R312.1.3 — Guard openings ≤ 4-inch sphere (the rule this calc solves)
- IRC 2021 R311.7.5.1 — Stair guards allow up to 4 3/8″ sphere (different rule)
- ASTM E2353 — Glass panel guard test method
Solver: even-spacing layout with N = ceil((inner_run − max_gap) / (baluster_width + max_gap)). Pricing 2026-Q1 retail (Home Depot, Lowe's, specialty railing suppliers). Labor multipliers from RSMeans 2026-Q1 residential indices.
The usable width between balusters in a section is the length between posts minus twice the post offset (one offset at each end of the section).
Smallest integer N such that the equal gap is ≤ max_gap. Algebra: starting from gap = (inner_run − N×bw) ÷ (N+1) ≤ max_gap, solve for N.
Once N is fixed, the remaining length minus all baluster faces, divided by the number of gaps (always N+1), gives the equal-spacing dimension. Rounded to 1/16″ in the diagram.
DeckMath assumes equal sections. For unequal sections, run the calc once per unique section length and sum the counts.
Two screws each end (top + bottom rail). Stainless #8 × 2½″ deck screws are sold by the 100-ct box; we round up to whole boxes.
Save your plan
Don’t lose this estimate.
Your inputs are preserved in the URL — email it to yourself or copy the link so you can compare with contractor bids later. No account needed.
Frequently asked
Questions, answered.
Embed this calculator
One line. Any site. Free.
Drop the snippet into your contractor site, blog, or marketing page. Theme matches the parent site automatically.
<!-- Drop into any HTML, WordPress, Webflow, or contractor site -->
<script src="https://embed.deckmath.com/v1.js"
data-deckmath-calc="baluster-spacing-calculator"
data-theme="auto"
async></script>Related