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
How to use the baluster spacing calculator in 6 steps.
- 1
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).
- 2
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.
- 3
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.
- 4
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.
- 5
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.
- 6
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
How DeckMath calculates this — IRC 2021 sources.
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.
Get matched
Want 2–3 free quotes for this exact deck?
We'll send your plan to vetted local builders. Free, no obligation.
People also ask
Baluster spacing questions, answered.
IRC 2021 R312.1.3 says any opening in a guard (railing) must be small enough that a 4-inch-diameter sphere cannot pass through. The rule prevents toddler-head entrapment. Inspectors carry an actual 4-inch sphere or a 4-inch slip-fit gauge. The calculator defaults to a 3 7/8″ max-gap target so you have a 1/8″ safety margin against tolerance — code compliance with no nail-biting at inspection time.
Depends on baluster width. For a 16 ft (192″) section between posts using 1.5″ wood 2×2 balusters with a 2.5″ post offset, the inner run is 187″. The math gives 35 balusters with a ~3.94″ equal gap — but at 3.94″ you're a hair over the 3 7/8″ safety target, so the calculator bumps to 36 balusters with a 3.78″ gap. For aluminum ¾″ pickets at the same dimensions, you'd use 47 balusters with a 3.30″ gap. The calculator solves this in one click.
Two reasons. First, inspector measurement variance — a slip-fit gauge can ride a hair high or low. Second, lumber tolerance — a 'nominal' 1.5″ baluster is actually 1.49-1.51″ depending on the mill. A 1/8″ safety margin (3 7/8″ target) absorbs both sources of variance. If you're working with metal pickets cut to factory tolerance, you can tighten to 4″ exactly; for wood balusters, keep the buffer.
Cable rail uses the same 4-inch sphere rule, but the rule is applied vertically (cable spacing) rather than horizontally (baluster spacing). IRC inspectors typically test by pressing a 3 1/8″ sphere against the cable — the cables stretch, so a smaller sphere is used in practice. Most cable systems use cables every 3″ on center with ~3 1/16″ clear gap. This calculator handles wood and metal balusters; for cable, use the 'cable infill' option to skip the baluster line and price the termination posts + tensioner kit.
Run the calculator once per unique section length and sum the baluster counts. Most decks have 2-3 unique section lengths (e.g. two long sides at 14 ft and two short sides at 8 ft). The calculator's section count assumes equal division — for unequal sections, treat each set as a separate calc run. The PDF export labels which section count corresponds to which length.
Yes — IRC R312.1.2 requires guards to be 'continuous' which inspectors interpret as plumb (vertical) for level rails and parallel-to-stringer for stair rails. Slanted balusters fail unless the spacing rule still holds in the slant plane. The calculator assumes plumb balusters; for stair rails, use the deck-stair-calculator with handrail option.
Yes for metal pickets — most aluminum picket systems use a U-channel baluster shoe screwed directly to the deck surface, eliminating the bottom rail. For wood balusters you should use a sub-rail (2×2 or 1×4 PT) for stability and to prevent water pooling on cut ends. The calculator's rail kit line includes a sub-rail by default; deduct 30% from that line if you're going shoe-only.
IRC 2021 R312.1.2 minimum is 36″ for one- and two-family residential. Some jurisdictions (and most commercial) require 42″, and many homeowners prefer 42 anyway for safety on tall decks. The rail height doesn't affect the baluster spacing math — it only affects the rail kit cost and the diagram's vertical extent. Switch to 42 in the inputs if you need it.
Wood 2×2 PT runs $4.85 each (36″ stock); cedar 1×1 is $3.40. Aluminum square pickets are $7.90 each, round are $8.80. Glass panels run $30-45/lf depending on cap material, no per-baluster cost. Cable systems skip balusters entirely but the termination posts are $80-120 each — typically only worth it for ocean views or modern-aesthetic builds. Toggle 'include cost' in the inputs to see your full BoM.
Most jurisdictions don't require submitted baluster spacing drawings on residential permits, but they will inspect the gap rule in person. Some inspectors carry the 4-inch slip-fit gauge; others eyeball it. Either way, having the calculator's PDF taped to the rail during inspection has prevented more than one re-do. Save it.
Yes. The action bar generates a clean printable document with the baluster count per section, the equal-gap dimension, the IRC reference, and the BoM. The CSV export gives you per-section data ready to paste into a spreadsheet. Copy Link gives you a shareable URL with all your inputs preserved.
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.
<!-- Baluster Spacing Calculator — free embed by DeckMath --> <a href="https://deckmath.com/calculators/baluster-spacing-calculator" data-deckmath-calc="baluster-spacing-calculator" data-theme="auto">Free Baluster Spacing Calculator by DeckMath</a> <script src="https://embed.deckmath.com/v1.js" async></script>
Plan the whole project, not just one number
The Deck Project Planner turns your dimensions into a complete material list, cost, 3D preview, and a PDF you can take to the lumber yard — all in one place.
Related