Deck Railing & Baluster Spacing Calculator

Free

Even, code-compliant baluster spacing under the 4-inch sphere rule — with counts, gaps and a mark-out list.

Units
Spacing mode

Railing sections

1 section
Pass
Balusters17
Even gap97 mm

Spacing & code

Measured as

Elevation preview

97 mm2.40 m clear×17 total

Drawn to scale for the first valid section. High-count runs are clamped and annotated with the true total.

Set-out (centerlines)

Section 1

1116 mm2252 mm3387 mm4523 mm5658 mm6794 mm7929 mm81,065 mm91,200 mm101,335 mm111,471 mm121,606 mm131,742 mm141,877 mm152,013 mm162,148 mm172,284 mm

Baluster centerlines measured from the inside face of the left post.

Prices & cost

Optional

Deck railing baluster spacing, solved

Getting balusters evenly spaced under the code limit is fiddly by hand: pick a count, work out the gap, check it against the rule, and adjust until it fits — for every section of a different length. This calculator does that solve for you. Enter a clear opening (or a post-to-post length and post size) and a baluster width, and it returns the smallest baluster count whose every gap sits below your chosen limit.

It works across as many railing sections as you have, rolls the counts up into a single buy-list with total rail length, and gives you a per-section mark-out list of baluster centerlines for setting out on site. Everything runs in your browser, and nothing you type leaves your device.

How this calculator works

In even mode the tool finds the minimum number of balusters so that all of the gaps — including the two end gaps against the posts — are strictly below the code limit, then splits the opening into that many equal gaps. In fixed on-center mode you set a target spacing instead, and the tool reports the resulting count, the actual gap, and whether it still passes the sphere rule.

How to space deck railing balusters

  1. Choose unitsPick metric or imperial; every field and result follows your choice.
  2. Add your sectionsAdd a railing run for each straight span and enter its length.
  3. Set baluster & gap ruleChoose a baluster width and the gap rule your code requires.
  4. Pick how you measuredEnter a clear opening, or a post-to-post length plus a post size to deduct.
  5. Read the take-offGet the count, even gap, pass/fail verdict and a centerline mark-out list.

Railing anatomy

A guard railing spans between two posts. A top rail and bottom rail run post-to-post, and the vertical balusters fill the space between them. The measurement that matters for code is the clear gap — the open distance between two adjacent balusters, and between a baluster and a post.

GapPostTop railBottom railBaluster
The parts of a guard railing. The clear gap between adjacent balusters is what the sphere rule measures.

The 4-inch sphere rule

Residential guards are governed by a sphere rule: the openings must be small enough that a 4-inch (100 mm) diameter sphere cannot pass through. If a 4-inch ball fits between your balusters, the gap is too wide. That is why the safe target is a clear gap of just under 4 inches — the calculator keeps every gap strictly below the limit, never exactly on it.

4-inch sphere ruleFailsGap too wide — sphere passesPassesGap under 4 in — sphere blocked
A gap fails if a 4-inch sphere passes through it, and passes if the sphere is held out.

Even vs uneven spacing

The common mistake is to space balusters at a round on-center figure and let whatever is left over become the end gap. That leftover gap at the post is often wider than all the others — and it counts against the rule just as much. Even spacing divides the whole opening into equal gaps so no single gap can slip over the limit.

EvenAll gaps equal & legalUnevenWide end gap fails
Even spacing keeps every gap equal; a round on-center figure often leaves an over-wide end gap.

Code limits & exceptions

The most common limits are the 4-inch (100 mm) guard sphere for decks and landings, and a 4⅜-inch (111 mm) sphere for the balusters on the open side of a stair. This tool models level, vertical balusters against those limits.

The stair triangular-opening exception — the larger 6-inch sphere allowed in the triangle formed by the tread, riser and bottom rail — is not modelled here, because that opening is not a plain vertical-baluster gap. Treat any figure from this tool as a planning estimate and confirm the exact requirement with your local building authority.

Frequently asked questions

Common questions about baluster spacing, end gaps and the sphere rule.

What is the 4-inch sphere rule?

Residential guards must not have openings large enough for a 4-inch (100 mm) diameter sphere to pass through. In practice that means the clear gap between balusters — and between a baluster and a post — must stay just under 4 inches. This calculator keeps every gap strictly below the limit.

Do the end gaps against the posts count?

Yes. With N balusters there are N+1 gaps, including the two at the ends against the posts. Those end gaps must meet the sphere rule just like the interior ones, which is exactly why spacing at a round on-center figure and letting the remainder fall at the ends can fail. Even mode divides the opening into equal gaps so none can slip over the limit.

How many balusters do I need?

The tool finds the smallest baluster count whose every gap is below your limit. As a rule of thumb it is roughly the opening length divided by the baluster width plus the maximum gap, but the exact count depends on staying strictly under the limit — the calculator solves it precisely for each section and totals them.

How is the even gap calculated?

For a clear opening L with N balusters of width b, the equal gap is g = (L − N·b) / (N + 1), because N balusters create N + 1 gaps. The calculator increases N until g drops below the code limit, then reports that count and gap.

Is stair railing spacing different?

Yes. On the open side of a stair, the balusters are allowed a slightly larger opening: a 4⅜-inch (111 mm) sphere must not pass, rather than the 4-inch sphere used for level guards. Choose the 4⅜-inch stair-guard rule for stair sections.

What about the 6-inch triangular opening on stairs?

At the open side of a stair, the triangular area formed by the tread, riser and bottom rail is allowed a larger 6-inch sphere. That exception applies to that specific triangle, not to the plain vertical-baluster gaps this tool models, so it is out of scope here — check it separately against your local code.

Can I work in metric or imperial?

Both. Switch units at any time and every length, gap and price converts. The gap-rule and post-size defaults also swap to the sensible choice for the system — the 4-inch guard for imperial, the 100 mm guard for metric.

Is the calculator private?

Yes. Every calculation runs in your browser. Nothing you enter is uploaded or stored on a server, and the tool works offline once the page has loaded.

Back to the calculator

Analytics help us to improve the quality of tools and workflows Privacy policy