Skip to main content

Baluster Spacing Calculator

Even baluster layout for level and stair railings: enter your rail length and baluster width and get the optimal baluster count, perfectly even spacing, a pass/fail check against the 4-inch sphere rule (IRC), newel post deduction, metric or imperial units, and a ready-to-cut cut list. Everything runs in your browser; nothing is uploaded.

Spacing calculator

Even gaps: n balusters → n + 1 equal spaces. Gap = (length − n×width) ÷ (n + 1).

in
in
Widest point (for turned/round balusters, the max diameter).
in
The optimizer picks the count closest to this.
in
IRC 4-inch sphere rule. Layouts above this are rejected.
in
in

Worked examples

1 — Level rail: 120 in, 1.5 in balusters

Target gap 3.5 in, code max 4 in → 23 balusters at an even gap of 3.5625 in (3 9/16 in), 5.0625 in (5 1/16 in) on-center. Clear gap 3.5625 in < 4 in → PASS (margin 0.4375 in = 7/16 in). Fewest balusters passing code: 22 at 3.7826 in gap.

2 — Newel post deduction: 144 in overall

Two 3.5 in newel posts → clear length 137 in → 27 balusters at 3.4464 in (3 7/16 in) even gap → PASS.

3 — Stair rail: 120 in along slope, 32.47°

7-in rise / 11-in run → angle 32.47°. Baluster footprint along rail 1 3/4 in. 20 balusters: gap along rail 4.021 in, effective clear gap 3.3924 in (3 3/8 in) → PASS.

Methodology

gap = (L − n·w) ÷ (n + 1)     on-center = gap + w

n balusters of width w on a clear rail length L leave L − n·w of open space, divided into n + 1 equal gaps (one at each end). The clear gap is the open space between baluster faces — the dimension the 4-inch sphere rule tests. On-center spacing (gap + w) is what you mark on the rail.

4-inch sphere rule (IRC, guards): no guard opening may allow a 4-inch (101.6 mm) diameter sphere to pass. Layouts with clear gap < 4 in earn PASS; ≥ 4 in is FAIL. The margin readout shows exactly how much room you have under the limit — wood moves and saw cuts vary, so do not design to 3.99 in.

Stair rails: measure the rail length along the slope; balusters stay plumb (vertical). A plumb baluster occupies footprint = w ÷ cos(θ) along the sloped rail, and the code-relevant opening is the effective clear gap = slope gap × cos(θ), which equals the level-rail gap for the horizontal run L·cos(θ). That is why a slightly wider gap along the rail still passes on stairs.

Units: 1 in = 25.4 mm exactly. Fractions round to the nearest 1/16 in for the shop.

Check your local code (AHJ). The IRC is the model code; local amendments can be stricter, and this tool checks opening sizes only — not guard height (36 in minimum per IRC), structural strength, or attachment.

Scope boundary: what this tool is (and isn’t)

  • This tool = baluster LAYOUT math. Even spacing from rail length + baluster width, a count optimizer around your target gap, the 4-inch sphere pass/fail verdict, stair (angled rail) mode with the cosine correction, newel post deduction, and a cut list.
  • NOT a fence picket tool. Fences have no sphere rule and different post logic — use the fence calculator for picket spacing.
  • NOT a deck materials estimator. For full deck board, joist, and fastener takeoffs use the deck material calculator; come back here for the railing balusters.
  • NOT a lumber volume tool. To convert the cut list into board feet for ordering, use the board foot calculator.

Related tools

Frequently asked questions

What is the formula for evenly spacing balusters?
Even spacing uses n + 1 equal gaps for n balusters: gap = (rail length − n × baluster width) ÷ (n + 1), and on-center spacing = gap + baluster width. Example: a 120 in rail with 1.5 in balusters and a 3.5 in target gap gives 23 balusters at an even gap of 3.5625 in (3 9/16 in), which is 5.0625 in (5 1/16 in) on-center.
What is the 4-inch sphere rule for railings?
The International Residential Code (IRC) requires guard openings to be small enough that a 4-inch (101.6 mm) diameter sphere cannot pass through. In practice every clear gap between balusters must be less than 4 inches. This calculator marks a layout PASS when the clear gap is under 4 in and FAIL at 4.00 in or more — a gap of exactly 4 inches fails because the test sphere fits through.
How many balusters do I need for a 10-foot rail?
For a 120 in rail with standard 1.5 in (2×2) balusters and a 3.5 in target gap: 23 balusters at an even 3.5625 in (3 9/16 in) gap — PASS, with 0.4375 in (7/16 in) of margin under the 4-inch limit. The fewest balusters that still pass code is 22, at a 3.7826 in (3 13/16 in) gap.
Do I count the spaces at the ends of the rail?
Yes. n balusters create n + 1 equal spaces: one between every pair plus one at each end. That is why the formula divides the leftover length by n + 1, not n. The end gaps equal the interior gaps, so the 4-inch sphere check applies to every opening including the ends.
How do I subtract newel posts from the rail length?
Measure the overall length, then subtract one post width per newel post: clear length = overall − posts × post width. Example: a 144 in overall run with two 3.5 in newel posts gives 137 in of clear rail, which lays out as 27 balusters at an even 3.4464 in (3 7/16 in) gap — PASS. Choose ‘Overall, including posts’ above and the calculator deducts them for you.
How is baluster spacing different on stairs?
On stairs, measure the rail length ALONG the slope and keep the balusters plumb (vertical). A plumb baluster’s footprint along the sloped rail is wider than its true width: footprint = width ÷ cos(angle). The clear gap the code tests is the effective horizontal opening: slope gap × cos(angle). Example: a 120 in sloped rail at 32.47° (7-in rise, 11-in run) with 1.5 in balusters gives 20 balusters; the gap along the rail is 4.021 in but the effective clear gap is 3.3924 in (3 3/8 in) — PASS.
Does the 4-inch rule apply to stair railings too?
Yes — the gaps between balusters on a stair guard must also block the 4-inch sphere, measured as the effective clear opening (see above). The one IRC exception is the triangular opening where a stair tread meets the guard, which may be tested with a larger 6-inch sphere instead. Baluster-to-baluster gaps get no such exception.
What is the difference between clear gap and on-center spacing?
Clear gap is the open space between two baluster faces — the number the 4-inch rule tests. On-center spacing is measured from the center of one baluster to the center of the next, and equals clear gap + baluster width. For the 120 in example: 3.5625 in clear gap versus 5.0625 in (5 1/16 in) on-center. Mark your layout with on-center dimensions; check code with the clear gap.
Can I use metric measurements?
Yes — switch to Metric and enter millimetres. Example: a 3000 mm rail with 38 mm balusters lays out as 23 balusters at an even 88.6 mm gap, PASS against the 101.6 mm (4 in) limit with 13 mm of margin. The math is identical; only the units change (1 in = 25.4 mm exactly).
Why can’t the gap be exactly 4 inches?
Because the code test is whether a 4-inch sphere can pass. A gap of exactly 4.00 in lets the sphere through, so it fails. The calculator marks 3.999 in as PASS and 4.000 in as FAIL. In practice, leave a comfortable margin — wood moves and cuts vary — which is why the results show your exact margin under the limit.
How long should I cut each baluster?
The cut list multiplies your baluster count by (baluster length + trim allowance). Example: 23 balusters at 32 in with a 1/2 in trim allowance = 23 × 32.5 in (32 1/2 in) = 747.5 in of stock (62′ 3 1/2″). On stairs, every baluster is the same length when the rail runs parallel to the stair slope — just miter the top cut at the stair angle (32.47° in the example).
What width do I enter for round or turned balusters?
Enter the widest point (maximum diameter). The sphere test applies to the narrowest opening, which is exactly where the baluster is widest — so the maximum diameter gives the conservative, code-safe gap. Gaps measured at the skinny part of a turned baluster will read larger, but the inspector’s 4-inch ball is tested at the tightest spot.
Do deck railings use the same spacing rule?
Yes. Deck guardrails follow the same 4-inch sphere rule for baluster openings. (The IRC also requires residential guards to be at least 36 in high measured from the deck surface — a separate check this spacing calculator does not perform.) Always confirm with your local building department (AHJ), as local amendments can be stricter than the IRC.
How is this different from a fence picket calculator?
This tool is built for railing balusters: n + 1 even gaps, the 4-inch sphere pass/fail verdict, stair (angled rail) mode with the cosine correction, and a baluster cut list. A fence picket calculator spaces pickets between posts under different rules — fences have no sphere test, and privacy fences often use zero-gap layouts. Use each tool for its own job.

Free tool by NRTechStudio