Deck Railing and Baluster Calculator
Enter the length of each railing side. You'll get the posts, the balusters per section with gaps under the building code's 4-inch limit, and the rails to buy.
- 2021 IRC guard rules
- AWC DCA 6 post spacing
- Feet or metric
2 What to buy
Updates as you type| Side 1: 12 ft | 2 sections with posts 6 ft on center; 12 balusters per section, 3.88 in gaps |
|---|---|
| Side 2: 16 ft | 3 sections with posts 5.33 ft on center; 11 balusters per section, 3.67 in gaps |
| Side 3: 12 ft | 2 sections with posts 6 ft on center; 12 balusters per section, 3.88 in gaps |
| Gap limit | Each gap must be less than 4 in (2021 IRC R312.1.3: no 4 in sphere may pass) |
| Guard height | At least 36 in above the deck surface (R312.1.2) |
Corners share one post, so the sides are counted as one continuous railing. If a side ends at the house wall, the last post can be replaced by a wall attachment the manufacturer or your building department approves. Check each gap with a 4 in ball or block after installing: a twisted baluster can open a gap.
Shopping list
Quick answer
The building code requires that no opening in a deck guard lets a 4-inch ball through, and the American Wood Council's deck guide spaces 4x4 posts up to 6 ft apart. A 6 ft section between 4x4 posts takes 12 wood 2x2 balusters (gaps about 3.88 in) or 14 metal 3/4 in balusters. Railing three sides of 12, 16 and 12 ft takes 8 posts and 81 wood balusters.
Balusters for common railing lengths
| Railing length | Posts | 2x2 wood balusters | Metal 3/4 in balusters |
|---|---|---|---|
| 8 ft | 3 | 16 | 18 |
| 10 ft | 3 | 20 | 24 |
| 12 ft | 3 | 24 | 28 |
| 16 ft | 4 | 33 | 36 |
| 20 ft | 5 | 40 | 48 |
| 24 ft | 5 | 48 | 56 |
| 30 ft | 6 | 60 | 70 |
| 40 ft | 8 | 84 | 91 |
One straight run, 4x4 posts no more than 6 ft apart, gaps under 4 in. Use the calculator above for your exact size.
The code rules for deck railings
- When you need one: 2021 IRC section R312.1.1 requires a guard where the walking surface is more than 30 inches above the floor or grade below, at any point within 36 inches of the open edge.
- Height: at least 36 inches above the deck surface (R312.1.2), and at least 34 inches on the open sides of stairs, measured from the line of the stair nosings.
- Openings: no opening from the deck surface to the required height may let a 4-inch sphere pass (R312.1.3). On the open sides of stairs the limit is 4-3/8 inches, and the triangle under the bottom rail at the stair can be up to 6 inches.
- Strength: Table R301.5 requires guards to resist a 200 lb concentrated load at the top and infill such as balusters to resist 50 lb on 1 square foot. Section R507.10.1 requires a continuous load path from the guard to the deck joists.
The 2024 IRC keeps the same values, renumbered as section R321. Your city or county may amend them, so check with your building department.
Post spacing
The IRC itself sets no post spacing. The American Wood Council's prescriptive deck guide, DCA 6, shows a wood guard with 4x4 posts at a 6 ft maximum spacing, 2x2 balusters between 2x4 top and bottom rails, and a 2x6 or 5/4 rail cap. Posts must not be notched where they attach to the deck (IRC R507.10.2), and DCA 6 attaches each one with two 1/2 inch through-bolts and a hold-down anchor rated at least 1,800 lb (for a guard up to 36 inches high; a taller guard needs engineered or listed hardware). Composite guards use the span on their label (R507.2.2.1), and other systems follow the manufacturer's instructions (R507.10.4).
How many balusters per section
Between 4x4 posts 6 ft apart on center there is 72 − 3.5 = 68.5 inches of clear space (a 4x4 is 3-1/2 inches actual). With n balusters there are n + 1 gaps, and each must be under 4 inches:
| Posts on center | Clear space | 2x2 wood (1-1/2 in) | Metal (3/4 in) |
|---|---|---|---|
| 4 ft | 44.5 in | 8 balusters, 3.61 in gaps | 9 balusters, 3.78 in gaps |
| 5 ft | 56.5 in | 10 balusters, 3.77 in gaps | 12 balusters, 3.65 in gaps |
| 6 ft | 68.5 in | 12 balusters, 3.88 in gaps | 14 balusters, 3.87 in gaps |
A gap just under 4 inches meets the rule but leaves no room for a bowed or twisted baluster, so check the finished railing with a 4-inch block, and add a baluster to any section that is close.
Worked example
A deck railed on three sides of 12, 16 and 12 ft, with posts no more than 6 ft apart: the 12 ft sides get 2 sections each and the 16 ft side gets 3 sections (posts 5.33 ft apart). That is 7 sections and 8 posts, with the corner posts shared, and 81 wood 2x2 balusters.
Frequently asked questions
How far apart should deck balusters be?
Close enough that no gap lets a 4-inch sphere through, under 2021 IRC R312.1.3. Between 4x4 posts 6 ft apart, that takes 12 wood 2x2 balusters or 14 metal 3/4 in balusters.
How high does a deck railing have to be?
At least 36 inches above the deck surface where a guard is required, and at least 34 inches on the open sides of stairs, under 2021 IRC R312.1.2. Some local codes require more.
When does a deck need a railing?
When the deck surface is more than 30 inches above the ground at any point within 36 inches of the edge, under 2021 IRC R312.1.1.
How far apart can deck railing posts be?
The IRC sets no number. The American Wood Council's DCA 6 guide shows 4x4 wood posts at a 6 ft maximum spacing; composite and metal systems use the span on their label.
Last reviewed 2026-11-06. See how we calculate for our sources and assumptions.