Enter the total length of railing, the post spacing and the baluster size to get the number of posts, sections and balusters, the exact gap to set between balusters and the length of top and bottom rail.
What this calculator does
- Balusters for a deck railing with a code-compliant gap
- Posts, sections and baluster spacing on center
- Top and bottom rail length, and baluster and post cost
How to use the deck railing calculator
- Add up the length of every side that gets a railing. Leave out stair openings and any side against the house.
- Count the separate runs. A run is an unbroken stretch that starts and ends at a post. A railing that turns a corner is still one run. A gap for stairs splits it into two.
- Enter the maximum post spacing and the post width.
- Enter the baluster width and the largest gap you will accept. Keep the gap under 4 in.
Formulas
Sections = total length ÷ maximum post spacing, rounded up Posts = sections + runs Opening = section length − post width Balusters per section = (opening − largest gap) ÷ (baluster width + largest gap), rounded up Actual gap = (opening − balusters × baluster width) ÷ (balusters + 1) Top rail = bottom rail = total railing length
A section with a given number of balusters has one more gap than balusters, because there is a gap against each post. Rounding the baluster count up and then spreading the leftover space evenly gives equal gaps that never exceed your limit. The sections are assumed to be equal. If yours are not, run each section length on its own with one run.
Worked example: 36 ft of railing in two runs
- Sections: 36 ÷ 6 = 6 sections of 6 ft. Posts: 6 + 2 runs = 8 posts.
- Opening between posts: 72 − 3.5 = 68.5 in, or 68 1/2 in.
- Balusters: (68.5 − 3.75) ÷ (1.5 + 3.75) = 12.33, so 13 per section.
- Gap: (68.5 − 13 × 1.5) ÷ 14 = 49 ÷ 14 = 3 1/2 in, which is 5 in on center.
- Total: 13 × 6 = 78 balusters, with 36 ft of top rail and 36 ft of bottom rail.
Balusters per section
| Opening between posts | Balusters | Gap |
|---|---|---|
| 36 in | 7 | 3 3/16 in |
| 48 in | 9 | 3 7/16 in |
| 60 in | 11 | 3 5/8 in |
| 68 1/2 in | 13 | 3 1/2 in |
| 72 in | 13 | 3 3/4 in |
| 92 1/2 in | 17 | 3 3/4 in |
The table uses 1.5 in balusters and a 3.75 in limit. Gaps are rounded to the nearest 1/16 in.
What the code asks of a deck railing
Under IRC section R312.1, a guard is required where the deck surface is more than 30 in above the ground below. The guard must be at least 36 in high, and no opening in it may let a 4 in sphere pass. That includes the space under the bottom rail. Some states and cities require 42 in, so check before you buy posts.
A guard also has to resist a 200 lb load at the top, which is a matter of how the posts are attached and not something a material count can check. Six feet on center is a common limit for 4×4 wood guard posts and is the figure used in the American Wood Council deck guide. Manufactured railing systems set their own spans. Treat these results as a layout and a shopping list, and let the local code or the system instructions govern.
Questions
How many balusters do I need per foot of railing?
A little over two per foot with 1.5 in balusters. The example above uses 78 balusters for 36 ft of railing, which is 2.2 per foot. Narrow metal balusters need more, because each one fills less of the opening.
How far apart should deck balusters be?
The clear gap must be less than 4 in. With 1.5 in balusters that means no more than about 5 1/2 in on center, and most builders aim for 3 1/2 to 3 3/4 in of clear space.
How far apart should deck railing posts be?
Six feet on center is a common maximum for 4×4 wood posts. Some engineered and manufactured systems allow 8 ft. Shorter sections feel stiffer and keep the top rail from sagging.
When does a deck need a railing?
The IRC requires a guard when the walking surface is more than 30 in above grade, measured to the ground within 36 in of the edge. Many owners add one on lower decks anyway.
Sources
- International Residential Code (2021), Chapter 3, Section R312.1 Guards, International Code Council.
Used for: guards where an open-sided walking surface is more than 30 in above the floor or grade below within 36 in of the edge, a guard height of at least 36 in, and no opening that passes a 4 in sphere (stair-side exceptions apply). - DCA 6: Prescriptive Residential Wood Deck Construction Guide (2015 edition, based on the 2015 International Residential Code), American Wood Council.
Used for: Figure 24, a wood guard with 4×4 posts at 6′-0″ maximum spacing, a 36 in minimum guard height and openings that do not allow a 4 in sphere to pass, and the guard post attachment rules.