Railing Calculator
Count balusters and posts for a railing that meets the 4 inch rule.
What you'll need to order
- balusters
- 4x4 posts
- top and bottom rail
- post anchors
- structural screws
Prices vary by region and haul distance. Get quotes from at least two local suppliers.
How this calculator works
balusters = railing length × 12 ÷ (baluster width + 3.875)
The 3.875 inch gap keeps a 4 inch sphere from passing through, which is the universal code requirement. Working to 3.875 rather than exactly 4 leaves a margin for construction error.
Switch the site to metric — the control is in the footer — and your inputs, your results and the tables below follow. The formula, the constants, the guidance text and the sources stay in US units on purpose: that is how the standards they come from are written, and restating them would detach each figure from the document you are meant to be able to check it against.
Where these numbers come from
- ICC International Residential Code 2021, R312.1.3 — guard opening limits — no opening that passes a 4 in sphere
Cited to a specific edition on purpose — table numbers and values move between cycles. Confirm against whichever edition is enforced locally.
Worked example
With railing length 24 ft, baluster width 1.5 in, post spacing 6 ft, this calculator returns 53.58 .
Balusters needed for railing runs of common length
Each row is a link that fills in the calculator above. Send one and the other end sees the same figures you do.
| Job | Size | Balusters needed |
|---|---|---|
| Short deck section | 10 ft × 1.5 in × 5 ft | 22.33 |
| Typical deck side | 24 ft × 1.5 in × 6 ft | 53.58 |
| Wrap-around deck | 48 ft × 1.5 in × 6 ft | 107.2 |
| Porch with square balusters | 20 ft × 2 in × 5 ft | 40.85 |
| Slim metal balusters | 24 ft × 0.75 in × 6 ft | 62.27 |
The gap is worked to 3⅞ in rather than a bare 4 so construction tolerance cannot push it over the limit.
Frequently asked questions
How far apart can balusters be?
Close enough that a 4 inch sphere cannot pass between them. In practice that means a maximum clear gap of just under 4 inches — most builders work to 3.875 inches to leave a margin.
How many balusters do I need?
Divide the railing length in inches by the baluster width plus 3.875. A 24 ft run with 2x2 balusters needs about 54.
How far apart should railing posts be?
Six feet maximum on most decks, and closer where the railing is tall or the guard load is high. The post connection to the framing, not the spacing, is what usually fails.
How tall does a deck railing have to be?
Thirty-six inches for residential decks under the IRC, and 42 inches in many commercial and some local codes. Measure from the walking surface to the top of the rail.