Deck railing calculator
Baluster count is not a guess and it is not a round number. It is set by one constraint: a 4-inch sphere must not pass through the gap. That means you calculate the gap, not the spacing — and the count that satisfies the rule is rarely the one that looks tidy on paper.
Your railing run
How this is calculated
The constraint is on the clear opening, so the spacing falls out of the baluster width:
- Maximum centre spacing = baluster width + 4″. A 1.5″ baluster can sit at most 5.5″ apart centre to centre.
- Gaps = ⌈(run − baluster width) ÷ max centre spacing⌉.
- Balusters = gaps + 1.
- Actual opening = (run − baluster width) ÷ gaps − baluster width. This must come out at 4″ or less.
Worked example
A 24 ft run, 1.5″ balusters, 6 ft post spacing:
- Run = 288″. Posts = ⌈24 ÷ 6⌉ + 1 = 5 posts, so 6 ft between them.
- Max centre = 1.5 + 4 = 5.5″
- Gaps = ⌈(288 − 1.5) ÷ 5.5⌉ = ⌈52.1⌉ = 53
- Balusters = 53 + 1 = 54
- Actual centre = 286.5 ÷ 53 = 5.41″, actual opening = 3.91″ ✓
Note that 54 balusters is not a number anyone would pick by eye. If you had laid out four inches on centre with a tape you would have ended up with 73 — legal, but 35% more material and a much busier rail. If you had spaced them evenly at 6″ you would have failed inspection at 4.5″.
Why the rule exists
IRC R312.1.3 requires that a 4-inch sphere not pass through any opening in a guard. It is a child-safety provision, and it is the single most common deck inspection failure. The measurement is the clear opening, not the centre distance — which is exactly what most quick calculators get wrong, because they ask for spacing and never check the result.
What the rail count does not prove
- It does not check post attachment. The guard has to resist a 200 lb concentrated load at the top rail. That is a connection design question, not a counting question — post brackets and through-bolts matter far more than post spacing.
- It does not account for stair rails. A stair guard has an angled rail and a different baluster layout; the run is measured along the slope.
- It does not model code amendments. Some jurisdictions require 42″ guards on raised decks regardless of occupancy.
- It does not include the gap at posts. The opening between the end baluster and a post must also satisfy the sphere rule — check it on site.
Questions people actually ask
How far apart should deck balusters be?
No more than 4 inches of clear opening, which is not the same as 4 inches centre to centre. With 1.5″ balusters that means about 5.5″ on centre — and because the run rarely divides evenly, you compute the count from the opening, not the spacing.
How tall does a deck railing need to be?
36 inches minimum for residential decks under IRC R312.1.2, measured vertically from the deck surface to the top of the guard. 42 inches applies to commercial occupancies, and some jurisdictions require it for elevated residential decks.
How many posts for a 24 foot railing?
At 6 ft spacing, five posts — one at each end plus three intermediate. That gives 6 ft between posts, which is within the common 6 ft maximum for a 36″ guard.
Do I need a railing on a low deck?
IRC requires a guard on decks more than 30 inches above grade. Below that it is optional under the model code, though local amendments and insurance requirements sometimes differ.
Can I use cable or glass instead of balusters?
Yes, but the 4″ sphere rule still applies to the openings, and both systems have manufacturer-specified post spacing and tension requirements. This calculator's baluster math does not transfer to either.