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 many railing posts and balusters a run needs
| Railing run | Posts at 6 ft | Posts at 8 ft | Balusters (1½″) | Clear opening | Top rail |
|---|---|---|---|---|---|
| 10 ft | 3 | 3 | 20 | 3.77″ | 20 lf |
| 12 ft | 3 | 3 | 24 | 3.88″ | 24 lf |
| 16 ft | 4 | 3 | 33 | 3.67″ | 32 lf |
| 20 ft | 5 | 4 | 40 | 3.77″ | 40 lf |
| 24 ft | 5 | 4 | 48 | 3.88″ | 48 lf |
| 32 ft | 7 | 5 | 66 | 3.67″ | 64 lf |
Baluster counts are for 1½″ balusters, 3½″ posts at 6 ft centers, with a 4″ maximum clear opening — the figure IRC R312.1.3 sets for a guard more than 30″ above the floor. A narrower baluster allows more of them across the same run; a wider one allows fewer. Top rail is two runs, top and bottom, over the same length.
How this is calculated
The constraint is on the clear opening, so the spacing falls out of the baluster width. The count is solved one bay at a time, because the posts interrupt the run:
- Maximum center spacing = baluster width + 4″. A 1.5″ baluster can sit at most 5.5″ apart center to center.
- Posts = ⌈run ÷ post spacing⌉ + 1, so bays = posts − 1.
- Clear span of one bay = (run ÷ bays) − post width. The posts occupy width that balusters cannot use.
- Balusters per bay = ⌈(clear span − 4″) ÷ (baluster width + 4″)⌉.
- Actual opening = (clear span − balusters × baluster width) ÷ (balusters + 1). This must come out at 4″ or less.
Worked example
A 24 ft run, 1.5″ balusters, 3.5″ posts at 6 ft centers:
- Run = 288″. Posts = ⌈24 ÷ 6⌉ + 1 = 5 posts, so 4 bays at 72″ center to center.
- Clear span in one bay = 72 − 3.5 = 68.5″
- Max center = 1.5 + 4 = 5.5″
- Balusters per bay = ⌈(68.5 − 4) ÷ 5.5⌉ = ⌈11.7⌉ = 12
- Total = 12 × 4 bays = 48 balusters
- Actual opening = (68.5 − 12 × 1.5) ÷ 13 = 3.88″ ✓ (5.38″ on center)
Note that 12 per bay is not a number anyone picks by eye. Setting them out at the maximum 5.5″ on center across the same bay gives 11 balusters and a 4.33″ opening — a fail. The count only comes out right when you solve for the opening rather than the spacing.
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 center distance — which is exactly what most quick calculators get wrong, because they ask for spacing and never check the result. The clause is R312.1.3; you can read IRC Chapter 3, Building Planning to confirm it.
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 center to center. With 1.5″ balusters that means about 5.5″ on center — 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.