Baluster Calculator

Last Updated: June 26, 2026

Calculate baluster spacing and the number of balusters you need for a railing, with even gaps that stay within the 4 inch code limit.

Required: total railing length and baluster width. Finds how many balusters you need plus the even gap between them.
+ Account for posts (optional)
Balusters needed
0
Layout details

Baluster Formula

The calculator runs in two modes. To find how many balusters you need, it solves for the count first and then the even gap:

N = ceil((L - G) / (W + G))
Gap = (L - N * W) / (N + 1)

To find the even spacing for a number of balusters you already have, it uses the gap formula on its own:

Gap = (L - N * W) / (N + 1)

If you account for posts, the clear length is reduced before either formula runs:

L = Run - (P * Pw)
  • N = number of balusters
  • L = clear railing length, meaning the run with any posts removed
  • W = width of one baluster or spindle
  • G = maximum gap you will allow between balusters
  • Gap = the even gap the calculator returns, used between every baluster and between the end balusters and the posts
  • Run = total length of the railing section
  • P = number of posts inside the run
  • Pw = width of each post

In count mode the calculator rounds the baluster count up, so the resulting gap is always equal to or smaller than the maximum you set. Because N balusters create N + 1 gaps, the spacing is divided across one more opening than the number of balusters. The post option subtracts the combined post width from the run first, so the spacing is calculated only across the open space where balusters actually sit. Every result also checks the gap against the 4 inch limit used by most U.S. residential guard codes.

Baluster Spacing Reference

The first table shows the widest on-center spacing that keeps the gap at or below 4 inches for common baluster widths, along with the rough number of balusters per foot of railing.

Baluster widthMax on-center spacingApprox. balusters per foot
0.75 in (square metal)4.75 in2.5
1.25 in5.25 in2.3
1.5 in (2x2 wood)5.5 in2.2
2 in6 in2.0

The second table explains how to read the gap the calculator returns.

Gap resultWhat it means
4 in or lessPasses the 4 inch sphere rule for guards (IRC R312.1.3). A 4 inch ball cannot pass through.
More than 4 inFails the common code limit. Add one or more balusters to close the gap.

Local codes can differ, so confirm the exact opening limit with your building department before you build.

Example Problems

Example 1. You have an 8 ft railing section, which is 96 inches, with no posts to deduct. The balusters are 1.5 inches wide and you want a maximum gap of 4 inches. First the count: N = ceil((96 - 4) / (1.5 + 4)) = ceil(92 / 5.5) = ceil(16.7) = 17 balusters. Then the gap: Gap = (96 - 17 * 1.5) / (17 + 1) = (96 - 25.5) / 18 = 70.5 / 18 = 3.92 inches. The gap is under 4 inches, so the layout meets code.

Example 2. You already plan to use 12 balusters that are 1.5 inches wide across a clear length of 60 inches. The even gap is Gap = (60 - 12 * 1.5) / (12 + 1) = (60 - 18) / 13 = 42 / 13 = 3.23 inches.

FAQ

What is the maximum allowed gap between balusters?
Most U.S. residential codes follow the 4 inch sphere rule (IRC R312.1.3), which means a 4 inch ball must not be able to pass between any two balusters. Keeping every gap at 4 inches or less satisfies that rule for level guards.

Why are there more gaps than balusters?
A run of balusters has an opening on each end, between the end balusters and the posts, plus one opening between each pair of balusters. That gives N + 1 gaps for N balusters, which is why the spacing formula divides the open space by N + 1.

Should I subtract the posts from my measurement?
Yes, if you measured the full railing run from post to post. Use the post option to remove the combined post width so the balusters are spaced only across the open area. If you measured just the open space between posts, you can leave the post fields empty.

Baluster Calculator