Building the whole deck?
Work out boards, joists and posts →On this page
How to Calculate Baluster Spacing
- Measure the clear length between the inside faces of the two posts. Every section can differ slightly, so measure each one.
- Pick your maximum gap. The code limit is 4 in on a level railing. Pick something smaller, around 3.5 to 3.75 in, to allow for wood movement.
- Count the balusters. Subtract one gap from the length, divide by baluster width plus gap, and round up. There is always one more gap than balusters.
- Work out the real gap. Subtract the total baluster width from the length and divide by the number of gaps. The result is smaller than your maximum, and every gap is the same.
- Mark from one post. The first baluster center sits one gap plus half a baluster from the post face; every other center is one on-center distance further.
Worked example: a 6 ft post spacing with 4x4 posts leaves 72 − 3.5 = 68.5 in clear. With 1.5 in 2x2s and a 3.75 in maximum: (68.5 − 3.75) ÷ 5.25 = 12.3, so 13 balusters. That leaves (68.5 − 19.5) ÷ 14 = 3.50 in gaps at 5.00 in on center.
Railing Code Figures
These are the residential figures from the International Residential Code, section R312, which most US jurisdictions adopt with local amendments:
| Rule | IRC Figure | Section |
|---|---|---|
| Opening in a level guard | No 4 in sphere passes | R312.1.3 |
| Opening on the open side of a stair | No 4-3/8 in sphere passes | R312.1.3, Exception 2 |
| Triangle at riser, tread and bottom rail | No 6 in sphere passes | R312.1.3, Exception 1 |
| When a guard is required | Walking surface more than 30 in above grade within 36 in of the edge | R312.1.1 |
| Guard height, level | At least 36 in | R312.1.2 |
| Guard height, open side of stair | At least 34 in from the nosing line | R312.1.2, Exception 1 |
Confirm these with your building department before you build. Some jurisdictions require 42 in guards, and commercial work falls under the IBC. This calculator flags a gap at or over the limit; it cannot approve a railing. For a deck’s other code points, see the deck calculator.
Balusters per Section
2x2 wood balusters (1.5 in), 3.75 in maximum gap. Every row is this calculator’s own output:
| Clear Length | Balusters | Gap | On Center |
|---|---|---|---|
| 36 in | 7 | 3.19 in | 4.69 in |
| 48 in | 9 | 3.45 in | 4.95 in |
| 60 in | 11 | 3.63 in | 5.13 in |
| 68.5 in | 13 | 3.50 in | 5.00 in |
| 72 in | 13 | 3.75 in | 5.25 in |
| 92.5 in | 17 | 3.72 in | 5.22 in |
The 68.5 in and 92.5 in rows are the clear lengths left by 4x4 posts set 6 ft and 8 ft on center. Notice that 68.5 in and 72 in both take 13 balusters: the extra length just opens each gap a little, until the next baluster is needed.
Baluster Mistakes to Avoid
- Using the 4 in figure as the target. Exactly 4 in is the failure line, and wood moves. Build under it.
- Measuring post centers instead of the clear gap. The posts themselves take up space; measure face to face.
- Laying out from both ends. Small errors meet in the middle as one odd gap. Mark from one post and check the far end.
- Measuring a stair along the rail. Balusters stand plumb, so the gap between them is horizontal. Measure the stair run, not the slope.
- Forgetting the bottom rail. The space between the deck and the bottom rail must pass the same test.
- Buying exactly the count. Buy a few extra for split and badly twisted pieces.
Building the stair too? The stair stringer calculator works out risers and treads, and the deck boards calculator handles the decking.
Frequently Asked Questions
What is the code for baluster spacing?
Under the International Residential Code (section R312.1.3), a required guard must not have any opening that lets a 4 in sphere pass through, from the walking surface up to the required guard height. On the open side of a stair the limit is 4-3/8 in, and the triangle formed by the riser, tread and bottom rail may not pass a 6 in sphere. Most US jurisdictions adopt these figures, but local amendments govern, so confirm with your building department.
How do I calculate baluster spacing?
Measure the clear length between the posts and decide the largest gap you will accept. The number of balusters is (length − gap) ÷ (baluster width + gap), rounded up. Then divide what is left evenly: actual gap = (length − balusters × width) ÷ (balusters + 1). A 68.5 in section with 2x2s and a 3.75 in maximum needs 13 balusters at a 3.50 in gap.
Why is there one more gap than balusters?
Because there is a gap at each post as well as between every pair of balusters. Thirteen balusters in a section make fourteen gaps. Forgetting this puts the last gap at the far post wider than the rest, often wide enough to fail the 4 in rule even when every other gap passes.
Is a 4 inch gap between balusters OK?
It is the limit, not a target. The code says a 4 in sphere must not pass through, so a gap of exactly 4 in is where you fail, and wood balusters shrink and twist after they are fastened. Aim for about 3.5 to 3.75 in so the railing still passes after a season of weather. This calculator defaults to 3.75 in for that reason; that default is our margin, not a code number.
How many balusters do I need per foot?
With 2x2 wood balusters at a 3.5 to 3.75 in gap, about 2.3 to 2.4 per foot of railing, since each one takes roughly 5 to 5.25 in on center. With 3/4 in metal balusters it is closer to 2.7 per foot, because the gaps stay the same but the balusters are thinner. Use the calculator for an exact count, because post positions decide the real number.
How many balusters per stair tread?
Usually two. The ICC commentary explains that the 4-3/8 in stair allowance exists so two balusters per tread will pass. On a 10 in tread with 1.5 in balusters, two balusters leave about 3.5 in gaps. Narrow treads or wide balusters can change that, so run the numbers with the stair option above.
How high does a deck railing have to be?
The IRC requires a guard of at least 36 in above the walking surface where the deck is more than 30 in above the grade below, measured anywhere within 36 in of the edge. On the open side of a stair the guard can be 34 in, measured from the line connecting the nosings. Some jurisdictions require 42 in; check yours.
Does the gap under the bottom rail count?
Yes. The opening limit runs from the walking surface up to the required guard height, so the space between the deck boards and the bottom rail must also stop a 4 in sphere. Keep the bottom rail no more than about 3.5 in above the decking.
How do I lay out balusters so they come out even?
Mark the first baluster’s center at one gap plus half a baluster from the post face, then mark every on-center distance after that. Better still, cut a spacer block to the exact gap and use it between each pair. Start from one post, and check that the last gap matches before you fasten the final few.
Are the code figures the same everywhere?
No. The IRC is a model code that states and cities adopt with amendments, and commercial buildings fall under the IBC instead. Your building department has the final word, and the inspector checks the railing in front of them, not this calculator.
Sources & Standards
- International Residential Code (ICC) — Residential construction requirements adopted by most US jurisdictions
Estimates for planning only. This calculator sizes material quantities. It does not size structural members, verify load paths, or confirm compliance with the code in your jurisdiction. Local requirements — frost depth, footing sizes, permits, and inspections — override anything here. Check with your local code enforcement office or building department before you build. They are the authority that inspects and signs off the work, they amend the model codes, and what they say overrides any figure on this page. For structural or safety-critical work, have the design checked by a licensed engineer or contractor as well. See our full method and assumptions.