PorchCalc / Decks / Deck baluster spacing calculator

Deck baluster spacing calculator

Find the fewest balusters that keep every equal gap under a sphere limit — 4 inches in 2021 IRC R312.1.3, where that code is adopted. This is layout math, not a sign-off that your rail will pass inspection.

Opening and balusters

Units
A common 2×2 is 1½ in dressed.
Sphere-limit shortcuts
These are 2021 IRC model-code figures. Confirm what your building department enforces.

Balusters to buy

55 balusters

13 per section × 4 sections, plus 5% extra.

Balusters in each opening
13
Clear gap
3.75 in
On-center spacing
5.25 in
Gap stays under the sphere limit
Yes

The 4 in / 4⅜ in figures are model-code checks, not a permit. For stair geometry, use the deck stair calculator.

How to use this calculator

Measure the clear opening between post faces. Enter the actual width of one baluster and the maximum clear gap you are designing to — 4 inches for a typical residential deck guard under 2021 IRC R312.1.3, if that code applies at your address. We find the fewest balusters that keep every equal gap, including the gaps against the posts, strictly smaller than that limit.

Worked example

A 72 in clear opening, 1½ in balusters, a 4 in sphere limit, four identical sections, and 5% extra.

  1. Minimum n = floor((72 − 4) ÷ (1.5 + 4)) + 1 = 13 balusters.
  2. Fourteen gaps: (72 − 13 × 1.5) ÷ 14 = 3.75 in clear, 5.25 in on center.
  3. Twelve balusters would leave a 4.15 in gap, which would let a 4 in sphere through.
  4. Four sections × 13 = 52. With 5% extra, buy 55 balusters.

Formula and assumptions

n = floor((opening − max gap) ÷ (width + max gap)) + 1
clear gap = (opening − n × width) ÷ (n + 1)
on center = width + clear gap
The clear gap must be strictly less than the sphere diameter.

Assumptions, dated November 22, 2026:

  • Gaps are equal, including the spaces against both posts, on a straight, level run.
  • The default 4 in limit and the optional 4⅜ in stair-guard figure are from 2021 IRC R312.1.3 and its exceptions, as quoted by the Stairbuilders and Manufacturers Association. Local codes may differ.
  • A gap equal to the sphere diameter is treated as a fail, because the sphere can pass.
  • We do not check guard height, the 6 in stair-triangle exception, or structural attachment.

FAQ

How many balusters fit in a 72 inch opening?

With 1½ inch balusters and a 4 inch maximum clear gap, you need 13 balusters and 14 equal gaps of 3.75 inches (5.25 inches on center). Twelve balusters would leave gaps of about 4.15 inches, wide enough for a 4 inch sphere to pass.

What is the 4-inch sphere rule?

The 2021 International Residential Code, section R312.1.3, says required guards shall not have openings that allow passage of a sphere 4 inches in diameter. That is a test of the clear opening, not a 4 inch on-center spacing. A gap of exactly 4 inches fails the test because the sphere can pass. The Stairbuilders and Manufacturers Association quotes this text from the 2021 IRC. Local amendments can be stricter.

Are stair guards different?

The same IRC section has exceptions: 4⅜ inches on the open side of stairs, and a 6 inch sphere at the triangular opening formed by the riser, tread, and bottom rail. We can run the math at 4⅜ inches if you choose that limit, but you still have to apply the right exception to the right opening and confirm it with your building department.

Is a 4 inch gap allowed if I am careful?

Not under the model-code wording we checked. The rule is that the sphere must not pass, so every gap needs to be strictly smaller than the sphere diameter, and real-world posts that are out of plumb shrink that margin. This calculator always keeps the equal gap under the limit you enter.

Do I measure post face to face or center to center?

Enter the clear opening: the inside face of one post to the inside face of the next. The gaps at both ends, against the posts, count in the equal spacing.

Is this a structural or guard-height calculator?

No. We do not check the 36 inch residential guard height, load ratings, or attachment hardware. We only space balusters in a straight run and compare the clear gap to a sphere diameter you can edit.

Sources we checked

  1. Stairbuilders and Manufacturers Association, “R312.1.3 Opening limitations” (quoting 2021 IRC): required guards shall not have openings that allow passage of a sphere 4 inches (102 mm) in diameter; exception 1, 6 in at the stair triangle; exception 2, 4⅜ in on the open side of stairs. Checked November 18, 2026.
  2. NIST PS 20: a nominal 2×2 is typically dressed to 1½ in, which is why that width is the default. Checked November 18, 2026.

What you'll need

Optional materials and supplies for this job. Each link opens an Amazon search. We do not list prices or ratings here — check the product page before you buy.

As an Amazon Associate I earn from qualifying purchases.

55 balusters3.75 in gaps