Railings

Baluster spacing calculator

Enter the rail length between two posts and this spaces the balusters so no gap passes a 4 inch sphere, the IRC guard rule: how many you need and the even gap between them. It is the same math the CutOnce app runs on deck and stair rails. Further down, a deck railing calculator lays out the posts on every run from a max post spacing and totals the balusters across all the sections.

Updated

The short answer

Space balusters so no clear gap is more than 4 inches (IRC R312.1.3, the 4 inch sphere rule). Take the rail length between posts, divide by the baluster width plus 4, and round up for the count. Then spread that many evenly, and the actual gap comes out at or below 4 inches.

Enter the clear opening between posts the way your tape reads: 6 ft, 72, or 5 ft 11-1/2 in. The IRC 4 in sphere rule caps the gap at 4 in; drop it lower for a tighter look.

Balusters14
Actual gap
3.40 in
Center to center
4.90 in
App StoreGoogle Play
Free to download. 7-day trial of everything.

The 4 inch sphere rule

Guards on decks, balconies, and stairs have to stop a 4 inch sphere from passing through, so a small child cannot slip between the balusters. That is the clear gap, the open space, not the center-to-center spacing, so a fatter baluster eats into the gap and a thinner one opens it up. The rule is why baluster spacing is never just 'divide the rail evenly': you size the count so the widest gap stays under 4 inches, then even it out.

How the spacing works

Two steps. First the count: the rail length divided by one baluster width plus the 4 inch max gap, rounded up, so every gap stays at or under 4 inches. Second the even gap: with that many balusters set in the rail, the leftover space splits into one more gap than there are balusters (the two ends to the posts count), so the gap is the rail length minus all the baluster widths, divided by the count plus one. It always lands at or under 4 inches.

A worked example

A 6 ft (72 in) rail between posts, in 1.5 in square balusters. Here is the count and the gap, and where each number comes from.

Rail length72 ingiven (post to post)
Baluster width1.5 ingiven (1.5 in square)
Balusters14ceil(72 / (1.5 + 4))
Even gap3.40 in(72 - count x 1.5) / (count + 1)
Center to center4.90 ingap + baluster width

Common rail lengths

Balusters and the even gap for typical rail sections in 1.5 in balusters at the 4 in code limit. Wider balusters need more of them; a longer rail opens the gap until the next baluster is added.

Rail lengthBalustersEven gap
36 in (3 ft)73.19 in
48 in (4 ft)93.45 in
60 in (5 ft)113.63 in
72 in (6 ft)143.40 in
96 in (8 ft)183.63 in

Deck railing calculator: posts and balusters

Enter the deck size, which sides meet the house, and the max post spacing. The calculator splits each railing run into equal sections, counts the posts with the corners shared, and spaces the balusters in every section to the same gap rule, the way the CutOnce deck calculator does.

Enter the deck the way your tape reads: 16 ft, 12 ft 6 in. Railing runs on every side not attached to the house. Leave the stair opening blank if the stairs come off somewhere else.

Posts8
Balusters81

Railing length 40 ft

RunLengthSectionsBetween postsBalusters eachOn centerGap
112 ft268-1/2 in125-3/8 in3-7/8 in
216 ft360-1/2 in115-3/16 in3-11/16 in
312 ft268-1/2 in125-3/8 in3-7/8 in

For each run, the section count is the run divided by the max post spacing, rounded up. The first run takes one more post than it has sections; each run after it shares the corner post with the run before, and a freestanding deck shares the last corner with the first. The clear span between post faces is the run divided by its sections, minus one post width. Each section gets the fewest balusters that keep every gap at or under the max, and the total is balusters per section times sections, added up over the runs. A stair opening adds one newel post and takes out the balusters that would have filled it. With the same on-center option on, every run is fit to one shared baluster spacing, picked halfway between the tightest and widest runs, so the rail reads the same all the way around.

This layout counts with the app's spacing solver, which finds the fewest balusters that keep every gap at or under the max, so a section can come out one baluster lighter than the single-rail count at the top of the page, which rounds up on the rail length alone. Both keep the gap at or under 4 inches.

A worked deck railing example

A 16 by 12 ft deck attached to the house on one long side, with 4x4 posts at 6 ft max spacing and 1-1/2 in balusters at the 4 in gap. Every number below comes from the same code as the railing calculator above.

Railing runs12 + 16 + 12 ftthe three sides away from the house
Railing length40 ftthe runs added up
Sections2 + 3 + 2 = 7each run / 6 ft, rounded up
Posts8sections + 1, corner posts shared
Between posts, short runs68-1/2 inrun / sections - 3-1/2 in post
Between posts, long run60-1/2 inrun / sections - 3-1/2 in post
Balusters per section, short runs12 at a 3-7/8 in gapfewest that keep the gap at or under 4 in
Balusters per section, long run11 at a 3-11/16 in gapfewest that keep the gap at or under 4 in
Total balusters8112 x 2 + 11 x 3 + 12 x 2
With a 4 ft stair opening9 posts, 73 balustersone newel post added, the opening's balusters taken out

Deck rail versus stair rail

On a level deck rail the balusters are plumb and evenly spaced along the rail, which is what this calculator lays out. On a raking stair rail the balusters follow the slope, and the code still measures the 4 inch sphere on the diagonal, so the along-the-rail spacing is a hair tighter than the level run underneath it. The app lays out both, and puts one or two balusters on every tread with the run measured along the nosing line.

How we verify this math

Common questions

How far apart should deck railing posts be?
No more than 6 feet on center is the common limit for wood deck railings, the spacing the AWC DCA 6 deck guide uses for guard posts, and many composite and aluminum rail systems allow 8 feet when the maker rates them for it; the IRC sets no post spacing of its own, but the finished guard has to hold a 200 pound load at the top (IRC Table R301.5) and stop a 4 inch sphere (R312.1.3).
How many posts do I need for a deck railing?
Divide each railing run by the max post spacing and round up for the sections. The posts come to one more than the total sections, because runs that meet at a corner share the corner post. A 16 by 12 ft deck attached on one long side has 40 feet of railing (12 + 16 + 12) and takes 8 posts at 6 ft spacing; a 4 ft stair opening adds a newel post for 9.
How many balusters do I need for a deck?
Multiply the balusters per section by the sections on each run and add up the runs. The same 16 by 12 ft deck in 1-1/2 in balusters at the 4 inch gap takes 81; the 4 ft stair opening drops it to 73.
How far apart can balusters be?
No more than 4 inches of clear gap, under IRC R312.1.3. That is the open space between balusters, measured so a 4 inch sphere cannot pass. It applies to any guard more than 30 inches above the ground, which covers most deck and stair rails.
How many balusters do I need for a 6 foot railing?
Fourteen, in 1.5 inch balusters at the 4 inch code gap, spaced about 3.4 inches apart. A 6 foot rail is 72 inches; 72 divided by (1.5 + 4) is 13.1, which rounds up to 14 so the gap stays legal. Wider balusters or a tighter target gap raise the count.
Is the 4 inches center to center or the gap?
The gap, the clear opening between balusters. Center-to-center spacing is the gap plus one baluster width, so with 1.5 inch balusters a 4 inch gap is 5.5 inches center to center. Sizing on center-to-center instead of the clear gap is the most common way a rail fails inspection.
Do the end gaps to the posts count?
Yes, and this calculator includes them. The balusters split the rail into one more gap than there are balusters, so a rail with 14 balusters has 15 gaps, counting the two at the posts. Keeping the end gaps equal to the field gaps is what makes the run look even.
What if I want a tighter look than the code minimum?
Set a smaller max gap and the count goes up. The 4 inch rule is a maximum, not a target; plenty of builders run 3 or 3.5 inches for a tighter, more finished look, especially with thin metal balusters. Enter your target gap and the calculator sizes the count to hit it.

Space the rail, frame the whole thing

CutOnce spaces the balusters like this page, on level rails and up raking stairs, and it frames the rest: the deck, the stringers, the posts, with a printable rail elevation showing every baluster placed.

Free to download, with a 7-day trial of everything. The web calculator is the teaser; the app draws the rail.

App StoreGoogle Play

See also