SOLVETUTORMATH SOLVER

Instrument MI-08-128 · Construction

Spindle Spacing Calculator

Balusters look wrong the moment their gaps are uneven, and many guard rails must also keep every opening under a maximum width. This sheet finds the fewest spindles that satisfy both, plus the exact gap you'll cut to.

Instrument MI-08-128
Sheet 1 OF 1
Rev A
Verified
Type 08 — Code Compliance — Railings SER. 2026-08128

Actual (even) gap between spindles (in)

3.7500

n = ceil((span - max gap) / (spindle width + max gap)), clamped to >= 0

13 Spindles needed
The working Every figure verified twice
  1. numSpindles = max(ceil((72 − 4) ⁄ (1.5 + 4)), 0) = 13
  2. actualSpacingIn = (72 − 13·1.5) ⁄ (13 + 1) = 3.7500
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

Evenly spacing spindles across a rail is a small constraint-satisfaction problem: you need enough spindles that every gap between them (and at each end) stays at or under some maximum, but not so many that you're buying and installing more than necessary. Adding spindles always shrinks the gaps, so the answer is the smallest spindle count for which the resulting even spacing is still no wider than your limit — one fewer spindle and the gap would cross the line.

The math behind it: n spindles sitting in a span create (n+1) gaps, since there's a gap before the first spindle, between each pair, and after the last. If every gap can be at most smax, the span must satisfy d ≤ n·w + (n+1)·smax, where w is spindle width. Solving for the smallest whole n that makes this true gives n = ceil((d − smax) / (w + smax)). Once n is fixed, dividing the leftover space evenly across all n+1 gaps gives the actual spacing you'll mark and cut to — almost always a little tighter than your stated maximum, since the ceiling rounds up to a whole spindle.

Many residential guard rails are required to keep openings narrow enough that a small child's head cannot pass through and become trapped — commonly a 4-inch maximum sphere in US model code, though the exact figure and how it's measured varies by jurisdiction and application (deck guards, interior stair rails, and porch railings aren't always treated identically). The maximum spacing here is a plain adjustable input, not a number baked into the formula, so you can enter your own code's limit or a design maximum for a purely decorative railing and get a mathematically correct even layout either way. Confirm the applicable maximum with your local building department before finalizing a code-governed railing.

n = ceil((span − max gap) / (width + max gap))
actual gap = (span − n × width) / (n + 1)
span — the rail length between posts, in inches · width — the width of one spindle, in inches · max gap — the largest allowable opening between spindles, commonly a code maximum but fully adjustable here · n — the number of spindles that keeps every gap at or under the maximum with the fewest pieces.
  • Measure the rail span between posts (or between a post and a wall) in inches.
  • Enter the width of the spindle stock you plan to use, in inches.
  • Enter the maximum allowable gap — commonly 4 inches for US residential guard rails, but check your local code or design intent.
  • Read Spindles needed and the Actual spacing — the exact even gap you'll mark out, which will be at or under your stated maximum.

Worked example — a 72-inch rail section

A porch railing section spans 72 inches between posts, using 1.5-inch square spindle stock, with a 4-inch maximum gap in mind. n = ceil((72 − 4) / (1.5 + 4)) = ceil(68 / 5.5) = ceil(12.3636) = 13 spindles. Dividing the remaining space evenly across all 14 gaps: actual spacing = (72 − 13 × 1.5) / 14 = 52.5 / 14 = 3.75 inches — comfortably under the 4-inch limit.

It's worth checking why 13 is the minimum: with only 12 spindles, the same math gives (72 − 18) / 13 = 4.1538 inches per gap — over the maximum, so 12 spindles would fail the spacing requirement even though it's a tidier-sounding number. The calculator always rounds the spindle count up to the point where the even spacing is guaranteed to fit under your stated maximum.

Questions

How many spindles do I need for a given rail length?

n = ceil((span − max gap) / (spindle width + max gap)), where span is the rail length, spindle width is the stock you're using, and max gap is the largest opening you'll allow. This finds the fewest spindles for which spacing them evenly keeps every gap at or under your maximum — one fewer spindle and the resulting gap would exceed it.

What is the maximum baluster spacing allowed by code?

US model residential code commonly limits guard openings to a 4-inch sphere so a young child's head cannot pass through and become trapped, though the exact figure, which railings it applies to, and how it's measured all vary by local jurisdiction and amendment. This calculator treats the maximum as a plain adjustable input rather than a fixed constant, so enter your own code's limit — and confirm it with your local building department for any load-bearing or code-governed guard rail.

Why isn't the actual spacing exactly equal to my maximum?

Because the spindle count has to be a whole number, and the formula rounds the count up to the smallest whole number of spindles that still fits under your maximum gap. That rounding almost always leaves the resulting even spacing a bit tighter than the stated maximum, not exactly equal to it — which is expected, not an error.

Does this calculator work for spacing anything other than balusters?

Yes — the underlying math is a general even-spacing problem: fit n objects of a known width into a span so that every gap between and around them stays at or under a maximum. It applies equally well to picket spacing, evenly spaced shelf dividers, or any layout where you need whole pieces spaced no wider than some limit.

What's the difference between this and a fixed baluster-count calculator?

A fixed-code calculator (built around one hardcoded maximum, like a 4-inch IRC gap) only ever answers "how many balusters at exactly that limit." This sheet takes spindle width and maximum spacing as adjustable inputs and reports the resulting actual spacing too, so it works equally for a code-governed guard rail, a stricter local amendment, or a purely decorative railing with its own design maximum.

References