mystaircalculator.com logo mystaircalculator.com
  1. Home
  2. Calculators
  3. Railing, Baluster & Safety
  4. Baluster Spacing Calculator
Railing, Baluster & Safety

Baluster Spacing Calculator

Enter your post-to-post span and get an evenly divided baluster layout that keeps every opening under the 4-inch sphere rule — count, exact gap, on-center spacing and fasteners, checked as you type.

Free to use No sign-up required Checked against the IRC guard-opening rule Imperial & metric supported
Baluster count & spacing calculated Clear gap and fastener count included Sphere-rule compliance chip built in Last verified July 2026
Checked line-by-line by our in-house stair-planning team before publishing — figures re-verified July 2026.
in

Measure between the inside faces of the two posts — not center to center on the posts.

inches

Diamond-mounted balusters present their diagonal to the sphere test, which increases the effective width used below.

Advanced: multiple spans
spans

Set this above 1 for a long run of railing broken by several intermediate posts, so totals reflect the whole railing.

Advanced: enter overall run instead
inches
inches

If you only measured the overall run (post face to opposite post face), enter it here with post width and this overrides the clear span field above.

Advanced: custom max opening
inches

4" is the general IRC residential guard figure. Some pool-barrier ordinances or child-safety guidance call for a smaller opening — [VERIFY] against your local code before relying on a stricter number.

Elevation diagram of the calculated baluster layout

Results

Balusters / Span
pcs
Actual Clear Gap
in
On-Center Spacing
in
Effective Width
in
Total Balusters
pcs
Total Fasteners
pcs
Total Clear Run
in
Max Opening Used
in
How to measure

Measuring your railing before you calculate

The calculator solves for the count and gap that fit your exact span. Get the span measurement right first — everything else follows from it.

1

Measure the clear, post-to-post span

Measure the horizontal distance between the inside faces of the two posts that will carry this run of balusters — not center to center on the posts, and not the overall outside dimension.

2

Confirm your baluster width

Measure the actual milled dimension of the baluster stock, not the nominal size. A "2x2" baluster is typically closer to 1.5" square once surfaced.

3

Decide the orientation

Flat-mounted square balusters present their face to the gap test. Diamond-mounted (rotated 45°) balusters present their diagonal instead, which is wider — pick the option that matches your actual install.

4

Read the compliance chips

Green means the calculated gap sits at or under the max sphere opening you set. Red means the span, baluster width, or orientation combination can't hit that opening — adjust one of them before you cut anything.

The math

The five formulas behind every result

Nothing on this page is a black box. Here's exactly what runs when you change a number.

Minimum Baluster Count

n = ceil[ (S − g_max) ÷ (w_eff + g_max) ]

The fewest balusters that can divide the span so every resulting gap is at or under the max opening — solved directly, not by trial and error.

Actual Clear Gap

g = (S − n · w_eff) ÷ (n + 1)

The span minus the balusters' combined width, split evenly across n+1 openings — including the two end gaps against the posts.

On-Center Spacing

OC = g + w_eff

The number you'd actually mark on the rail with a tape measure — center of one baluster to center of the next.

Effective Width by Orientation

w_eff = w  (flat / round)  ·  w×√2  (diamond)

A square baluster rotated 45° presents its diagonal to the gap, not its face — that diagonal is what actually has to clear the sphere test.

Total Balusters & Fasteners

N = n × spans    F ≈ N × 2

Multiply the per-span count across every identical span in the run, then figure roughly two fastening points (top and bottom) per baluster as a planning estimate.

Worked example

Walking through a real 74" span — and what changes with a diamond mount

Same formulas, filled in step by step, for a deck railing section measuring 74" clear between posts, using 1.5" square balusters and the standard 4" max opening.

1

Flat-mounted baluster count

74" span, 1.5" balusters flat-mounted, 4" max opening: n = ceil[(74 − 4) ÷ (1.5 + 4)] = ceil(70 ÷ 5.5) = ceil(12.73) = 13 balusters.

2

Actual gap and on-center spacing

g = (74 − 13×1.5) ÷ 14 = 54.5 ÷ 14 = 3.89" clear gap. On-center spacing is 3.89 + 1.5 = 5.39" — close to the "roughly 5 inches on-center" rule of thumb many carpenters use, which is really just this formula approaching its limit.

3

Same balusters, rotated 45° for a diamond look

The client likes the diamond mount instead. Effective width becomes 1.5 × 1.41421 = 2.12" — the diagonal, not the face, is what the sphere has to clear. Recalculating: n = ceil[(74 − 4) ÷ (2.12 + 4)] = ceil(70 ÷ 6.12) = ceil(11.44) = 12 balusters.

4

Where that interaction bites

g = (74 − 12×2.12) ÷ 13 = 48.56 ÷ 13 = 3.73" clear gap. One fewer baluster is needed for the identical span — not because the rule got looser, but because each diamond-mounted baluster now eats more of the opening allowance on its own. Reusing the flat-mount count of 13 with diamond balusters would actually shrink every gap well under 4", wasting material; reusing the diamond count of 12 with flat-mounted balusters would push the gap toward the fail side. The orientation has to be locked in before the count is final.

This is exactly why "just rotate the same balusters" is listed as a common mistake below — the count and gap are only valid for one specific orientation at a time.

Quick reference

On-center spacing, rule-of-thumb by baluster width

These are asymptotic planning figures (width + max opening) for a long run — the calculator above solves the exact figure for your actual span. Use this table to sanity-check a number, not to build from directly.

Baluster WidthApprox. O.C. @ 4" max gapApprox. O.C. @ 3" max gap
3/4"≈4.75"≈3.75"
1"≈5.00"≈4.00"
1.5" (standard)≈5.50"≈4.50"
2"≈6.00"≈5.00"
2.5" (turned/decorative)≈6.50"≈5.50"

The 3" column reflects a stricter opening sometimes required by pool-barrier ordinances or child-safety guidance — [VERIFY: confirm whether your jurisdiction's pool/child-safety code actually requires 3" instead of the general 4", since this is set locally and not by a single national figure].

Code reference

Sphere-rule max opening by context

This calculator checks your result against the general 4" figure by default. Full code coverage varies by context and edition — confirm the exception rows below against your adopted code.

ContextMax Sphere OpeningNotes
IRC residential guards (general infill)4"The figure this calculator defaults to.
IRC stair triangular opening (below bottom rail)[VERIFY] 6"Applies only to the triangular gap formed by riser, tread, and bottom rail — not to baluster-to-baluster spacing along the same stair guard.
IBC commercial guards[VERIFY] 4"Generally mirrors residential; confirm against your adopted commercial code edition.
Pool barrier / child-safety guidance[VERIFY] 3"–4"Not a single national figure — set by local ordinance, so confirm locally before designing to 3".
Pre-code / historic constructionoften 6"+Common in stairs built before modern sphere-rule adoption; typically needs a retrofit to reach current code.

Reference only — always confirm against your local jurisdiction's adopted code before building.

Beyond the sphere rule

Triangular openings, post spacing & fastening

A layout can pass the baluster-spacing math perfectly and still miss on three things this section covers — a misapplied exception, an unsupported post span, and an undercounted fastener list.

The triangular-opening exception

Stair triangle ≤ [VERIFY] 6"

Some codes allow a larger sphere through the triangular gap formed by the riser, tread, and bottom rail at the open side of a stair — but this exception covers that one triangle, not the baluster-to-baluster gaps running up the rake. Every other opening on that same guard still has to meet the general 4" figure.

Post spacing & rail rigidity

Typical post spacing ≤ [VERIFY] 72"–96" o.c.

The sphere rule governs infill gaps, not how far apart posts can sit. Post spacing is a structural/deflection question tied to rail material, section size, and expected load — manufacturer span tables and local structural code vary, so a long clear span may need mid-span bracing regardless of what the baluster math shows.

Fastening each baluster

Fasteners ≈ Balusters × 2

Two fastening points per baluster — top and bottom — is a common planning estimate for screwed or pocket-screwed installs. Through-bolted balusters, glued-in dowel systems, or proprietary baluster connectors can change this to one point per end or add hardware this estimate doesn't include.

End baluster placement

End gap = middle gap

The gap between the post and the first baluster follows the same max-opening rule as every gap between two balusters — there's no separate, looser allowance at the ends. The formula above already treats it that way by dividing the span into n+1 equal openings, not n.

These are planning-stage estimates, not a stamped structural design. A long span, an unusual load, or a heavy infill material may need an engineer's sign-off regardless of what this calculator shows.

Avoid these

Common mistakes when planning baluster spacing

Most failed inspections on infill spacing trace back to one of these five planning errors, not to bad carpentry.

📏

Checking on-center spacing instead of the gap

Code limits the clear opening between balusters, not the center-to-center distance. A tape measure reading the on-center number can look fine while the actual gap is over the limit — especially with wider balusters.

🔁

Rotating balusters without recalculating

Switching a run to a diamond mount changes the effective width the sphere test sees. Reusing a flat-mount count and gap after rotating the balusters 45° silently changes the resulting opening.

🪜

Applying the stair triangle exception too broadly

A larger allowed opening at the triangular gap under a stair's bottom rail does not loosen the baluster-to-baluster spacing on the same guard — those remain two separate checks.

📐

Forgetting to subtract post width

If the only measurement taken was the overall outside-to-outside run, plugging it in directly overstates the usable span by roughly two post widths — use the overall-run field so post width gets subtracted correctly.

🧱

Eyeballing an even count

Guessing a baluster count and spacing it "close enough" by eye often leaves one end gap wider than the rest — including the two gaps against the posts, which have to meet the same limit as every gap in between.

Who uses this

When to use a baluster spacing calculator

Baluster layout shows up any time a guard or stair railing goes in or gets replaced, indoor or out.

🌳

Deck & Porch Guardrail Builds

Laying out baluster count and spacing before cutting infill stock.

🪜

Interior Stair Guard Replacement

Swapping out an old, wide-spaced guard for a code-compliant layout.

📏

Multi-Span Long Deck Railings

Running consistent spacing across several posts on a long run.

🏊

Pool Fence / Barrier Compliance

Confirming infill spacing against a locally stricter opening size.

💎

Custom Diamond-Baluster Design

Working out count and gap for a rotated, decorative baluster look.

📋

Code Compliance & Permit Prep

Confirming spacing numbers before a plan check or inspection.

FAQ

Common questions

What is the 4-inch sphere rule for balusters?
It's the residential guard-opening rule stating that no gap in a guard's infill — including the space between balusters, and between a baluster and the post — should allow a 4-inch sphere to pass through, since that's roughly the size of a young child's head.
Is on-center spacing the same as the code-required gap?
No. On-center spacing is baluster center to baluster center. The code limit applies to the clear gap between them — the on-center figure minus one baluster width. Mixing the two up is one of the most common spacing errors.
Do the two end gaps next to the posts follow the same rule?
Yes. The gap between a post and the nearest baluster has to meet the same maximum opening as every gap between two balusters — there's no separate, looser allowance at the ends.
How does mounting balusters diamond-style (45°) change the spacing?
A square baluster rotated 45° presents its diagonal to the sphere test instead of its face, which is roughly 41% wider. That larger effective width usually means fewer balusters are needed across the same span to hit the same max opening.
Does the stair triangular-opening exception let me space stair balusters further apart?
No. That exception covers only the triangular gap formed by the riser, tread, and bottom rail at the base of a stair guard. The baluster-to-baluster gaps running up the rake still have to meet the general opening limit.
What if my span is already narrower than the max opening?
If the clear span alone is already under your max sphere opening, the sphere rule alone doesn't require any balusters — though most railings still include them for rigidity, appearance, and to meet a minimum infill requirement some codes set separately from the sphere test.
How much extra do I need for fasteners?
A common planning estimate is two fastening points per baluster — one top, one bottom. Through-bolted balusters, dowel-and-glue systems, or proprietary connector hardware can change that count, so treat this as a starting shopping-list figure rather than an exact bill of materials.
Is 4 inches the right number for a pool fence or child-safety barrier?
Not necessarily — some jurisdictions require a smaller opening, commonly cited around 3 inches, for pool barriers or dedicated child-safety fencing. That figure is set locally rather than by one national standard, so confirm it with your building department before designing to a stricter number.
Do cable railings or glass panels use the same spacing math?
No — cable infill is governed by tension and vertical spacing rather than a fixed baluster width, and glass panels are sized as whole units rather than individually spaced. See the Cable Railing Calculator or Glass Railing Panel Calculator for those cases.
Why does my calculated gap come out just under my max opening instead of exactly at it?
The calculator solves for the fewest balusters that keep every gap at or under your limit, then divides the span evenly across all of them. Because the baluster count has to be a whole number, the resulting gap is almost always a little under the maximum rather than landing on it exactly.
Does a long run need more posts, not just more balusters?
Possibly. The sphere-rule math above only governs infill spacing. A single clear span that's structurally too long for the rail material to stay rigid may need an intermediate post regardless of how the baluster count works out — that's a separate structural check.