Deck Railing Calculator — Posts, Rails & Spindles
Enter total railing length, number of straight runs, post spacing, and post size to get posts, rail sections, spindles per section, and rail boards to buy.
Posts
5
5 per run × 1 run · 71.1 in on center
Rail Sections
4
Each 67.63 in clear between 4x4 posts
Balusters
52
13 per section · 3.44 in gap — passes the IRC R312.1.3 4-inch sphere rule
Rail Boards
8 × 8 ft
8 top and bottom rail pieces at 67.63 in, 1 per board
Guard Height
36 in
Meets the IRC R312.1.2 minimum of 36 in
How the railing is counted
The total length is split equally across the straight runs you enter. Each run is divided into sections no wider than your maximum post spacing (measured center to center): sections = (run length − one post width) ÷ spacing, rounded up, and posts = sections + 1. The clear length of each section is what's left after deducting the actual width of every post in the run (4x4 (3.5 in actual), 6x6 (5.5 in actual)) — that is the length the balusters have to fill and the length each rail piece is cut to.
Corner posts are counted conservatively: every run gets its own two end posts, so a corner costs one extra post compared with sharing a single post between the two runs. If you plan to share corner posts, subtract one post per shared corner. If your runs are different lengths, calculate each run on its own with one straight run and add the results.
Code checks: guard height and openings
IRC Section R312.1.2 requires guards on decks more than 30 inches above grade to be at least 36 inches high, measured from the deck surface. Section R312.1.3 limits openings so that a 4-inch sphere cannot pass through — between balusters, and between the bottom rail and the deck. The baluster count and gap for each section here come from the same calculation as the baluster spacing calculator, which you can use on its own for a single section; the baluster spacing code guide walks through the rule.
The IRC gives no maximum post spacing for guards; the prescriptive deck guides most jurisdictions publish use 6 ft on center for 4x4 posts, and some post-to-rim anchors are rated for less. Guard posts also have to resist a 200-pound concentrated load (Table R301.5), which is a connection detail, not a spacing rule — check your post anchor's listing.
Rail boards
Each section has a top and a bottom rail running post to post, so there are two rail pieces per section, each one clear section long. The calculator cuts as many pieces as fit from each stock board (pieces per board = stock length ÷ piece length, rounded down) and rounds the board count up. Choosing a longer stock length usually reduces waste when more than one piece fits in a board. A cap rail on top of the posts is not included.
Frequently asked questions
- How many posts does a deck railing need?
- Count the sections first: divide each straight run (less one post width) by your maximum post spacing and round up, then add one post per run. A 24 ft straight run at 6 ft maximum spacing needs 4 sections and 5 posts. The same 24 ft split into 2 runs around a corner needs 6 posts, because each run gets its own end posts and this calculator does not share a corner post between runs.
- How far apart should deck railing posts be?
- The IRC does not set a maximum guard post spacing; 6 ft on center is the usual limit in prescriptive deck guides, and some post anchors are rated for less. This calculator takes the maximum as an input (4, 6, 8 ft) and spaces the posts evenly at or under it — the 24 ft example lands at 71.1 in on center.
- How many spindles do I need per railing section?
- It depends on the clear length between posts and the baluster width. Each section of the 24 ft example is 67.63 in clear between 4x4 posts; with 1.5 in balusters that takes 13 per section, 52 in total, with a 3.44 in gap that passes the IRC R312.1.3 4-inch sphere rule. The count and gap come from the same calculation as the baluster spacing calculator.
- How tall does a deck railing need to be?
- IRC R312.1.2 requires a residential guard to be at least 36 inches above the deck surface where the deck is more than 30 inches above grade. 42 inches is common where a local amendment or the commercial IBC (1015.3) applies. Both heights offered here meet the IRC minimum; the material counts do not change with height.