Home›Deck Railing Calculator
Deck Railing Calculator
Work out everything a deck railing needs — sections, posts, balusters and rail lumber — with a cost estimate. A railing is built section by section: posts at the spacing, balusters between them, rails on top and bottom.
Calculate your deck railing
Posts are spaced at most 6 ft apart (AWC DCA 6). Each section is counted on its own: the clear opening between posts, less the 3½ in post width, divided by the baluster spacing. Baluster gaps must stay under 4 in (IRC R312).
Your results
How the deck railing formula works
A railing is built section by section. Count the sections, add one post per section end, then count balusters inside each section.
Sections: ceil(railing length ÷ post spacing) — posts at most 6 ft apart (AWC DCA 6)
Posts: sections + 1
Clear opening per section: section length − 3.5 in (post width)
Balusters per section: ceil((clear − max gap) ÷ (baluster width + max gap))
Rail lumber: sections × post spacing × 3 — top, bottom and cap rail, bought in full stock lengths per section
This is the BackyardCalculators / BrightCalculator / NailTheMath method, and it reproduces the published example: a 40 ft railing at 6 ft post spacing is 7 sections (40 ÷ 6 = 6.67, rounded up), 8 posts, and each section’s clear opening is 68.57 − 3.5 = 65.07 in, which takes 13 balusters at a 3.5 in gap — 91 balusters in total, 96 with 5% waste. Rail lumber is 84 ft of top and bottom rail plus 42 ft of cap — 126 lin ft. Cost at $25 per post, $3 per baluster and $2 per lin ft of rail: $740 (BackyardCalculators’ worked example exactly).
Worked example
A 40 ft railing, posts at 6 ft, 1½ in balusters, 3.5 in maximum gap, posts $25, balusters $3, rail lumber $2 per lin ft, 5% waste:
Sections: 40 ÷ 6 = 6.67 → 7 sections; posts: 7 + 1 = 8 posts
Section length: 40 ÷ 7 = 5.71 ft = 68.57 in; clear: 68.57 − 3.5 = 65.07 in
Balusters per section: (65.07 − 3.5) ÷ (1.5 + 3.5) = 12.31 → 13 per section
Total balusters: 13 × 7 = 91; with 5% waste: 91 × 1.05 = 95.55 → 96 balusters
Rail lumber: 7 sections × 6 ft × 3 = 126 lin ft
Cost: posts 8 × $25 = $200; balusters 96 × $3 = $288; rails 126 × $2 = $252; total $740
A 24 ft railing at 6 ft spacing needs 4 sections, 5 posts, 13 balusters per section (52 total, 55 with waste) and 72 lin ft of rail — $434 at the same prices. A 10 ft railing needs 2 sections, 3 posts, 11 balusters per section (22 total, 24 with waste) and 36 lin ft of rail — $219.
How much does a deck railing cost? (US, 2026)
Prices are 2026 US ranges from Home Depot / Lowe’s listings. A full railing system runs $20–$60 per linear foot installed, depending on material. Check local prices before ordering.
| Item | Typical price |
|---|---|
| Wood post (4×4 × 8 ft) | $15–$30 each |
| Wood baluster (1½ in) | $2–$4 each |
| Metal baluster | $3–$8 each |
| Rail lumber (2×4 / 2×6, per lin ft) | $1–$3 |
| Post cap / post base | $5–$15 each |
| Railing, installed (per lin ft) | $20–$60 |
Waste allowance
Add 5% to the baluster count — a split baluster or a wrong cut is common, and balusters are cheap. Posts and rail lumber do not need waste: posts are counted exactly and rail lumber is bought in stock lengths (8, 10, 12 ft), so round up to whole boards instead. If your railing has a gate or a stair opening, measure each run separately and add the runs together.
Frequently asked questions
How many posts do I need for a deck railing?
Divide the railing length by the post spacing (max 6 ft) and round up for sections, then add 1: a 40 ft railing at 6 ft spacing is 7 sections and 8 posts. A 24 ft railing is 4 sections and 5 posts.
How far apart should deck railing posts be?
At most 6 ft apart (AWC DCA 6). 5 ft is a common choice for a stiffer railing, and 4 ft is used for heavy railings or high decks. Closer posts mean more sections and more balusters per section, but the baluster count per section stays similar.
How many balusters do I need for a deck railing?
Count per section: a 6 ft section with 1.5 in balusters at a 3.5 in gap needs 13 balusters. A 40 ft railing has 7 sections, so 91 balusters — 96 with 5% waste. Use the baluster spacing calculator for a single opening.
How high should a deck railing be?
The IRC requires a guard railing at least 36 in high on residential decks (42 in in some jurisdictions and for commercial decks). Measure from the deck surface to the top of the rail. The baluster gap rule (under 4 in) applies at every height.
How much does a deck railing cost per foot?
A wood railing runs about $20–$35 per linear foot for materials, $35–$60 installed. A 40 ft railing is roughly $740 in materials (posts, balusters and rails) at 2026 prices — more for metal or composite balusters.