Skip to content

Baluster spacing calculator: equal gaps for railings, gates and fences

Updated on 20 November 2026

Balusters in a railing, pickets in a fence, bars in a gate: they look right only when every gap is the same, including the two at the posts. The math is short, but marked one baluster at a time the errors add up and the last gap comes out wrong. This calculator gives the gap, the on-center spacing and the position of every baluster, all measured from the same post face.

For the gate frame, the 45° square tube miter is the square tube miter, and the picket meeting the rail is the square tube tee.

Baluster spacing calculator

Enter the opening, between the inside faces of the two posts, and the baluster width. Choose the number of balusters, or the largest gap allowed, and the calculator finds how many fit. With the length of each baluster, it adds up the total stock. Fractions work (3/4, 3-1/2").

Only paying users can use this calculator

The formula and the worked example are in the text on this page. The calculator, with your own measurements, is part of full access.

Buy full access Already have access? Sign in

The formula

Gap
g = (L − n × w) / (n + 1) L is the opening, n the number of balusters and w the width of each. There are n + 1 gaps, because there is one at each post.
On-center spacing
s = g + w From one baluster to the next, center to center or edge to edge.
Mark of baluster i
x = i × g + (i − 1) × w The left edge of baluster i, measured from the left post face. Marking every baluster from the same face, not from the previous baluster, keeps the errors from adding up.
By maximum gap
n = ⌈(L − gmax) / (w + gmax)⌉ The fewest balusters that keep the gap at or below the maximum.

Worked example

A 48" opening filled with 3/4" square balusters:

  1. With 10 balusters: gap (48 − 10 × 0.75) / 11 = 3-11/16".
  2. On-center spacing: 3.68 + 0.75 = 4-7/16".
  3. Marks from the left post: 3-11/16", 8-1/8", 12-9/16", 17", 21-7/16", 25-13/16", 30-1/4", 34-11/16", 39-1/8" and 43-9/16".
  4. Check: the last baluster ends at 44-5/16", one gap short of the other post.

With 9 balusters the gap would be 4-1/8", too wide for a residential guard. Set the maximum gap to 3.9" and the calculator picks 10.

Railings: the 4-inch sphere rule

In US residential guards, the International Residential Code (IRC R312) does not let a 4-inch sphere pass between balusters. Use a maximum gap under 4" and check your local code and the project. In metric countries the rule is often 100 or 110 mm.

Frequently asked questions

How do you calculate baluster spacing?
Subtract the width of all balusters from the opening and divide what is left by the number of balusters plus one: g = (L − n × w) / (n + 1). A 48" opening with 10 balusters of 3/4" gives a 3-11/16" gap.
What is the maximum gap between balusters?
Under the IRC a 4-inch sphere must not pass, so keep the gap under 4". Check your local code.
Why mark every baluster from the same post?
Because marking from the previous baluster adds each small error to the next, and the last gap comes out wrong. From the same face, every mark carries the error of one measurement only.

Parts in this guide

Other guides