How the count and spacing are worked out
The calculator starts from the clear length between the faces of the two posts. It finds the fewest balusters that keep every opening, including the two against the posts, under the limit, then spreads them evenly. That is the method YellaWood gives: add one baluster’s width to the clear length, divide by the largest opening plus one baluster, and round up to get the number of spaces.
One change from the rounding as written: if the division comes out exactly whole, the calculator adds a space. Otherwise the openings would come out exactly at the limit, and the code’s sphere must not pass.
Worked example: 4×4 posts 6 ft apart on center, wood 2×2 balusters
- Clear length: 72 − 3½ = 68½ in.
- (68.5 + 1.5) ÷ (4 + 1.5) = 70 ÷ 5.5 = 12.73, rounded up to 13 spaces: 12 balusters.
- On center: 70 ÷ 13 = 5.385 in, 5⅜ in on the tape. Openings: 5.385 − 1.5 = 3.885 in, about 3⅞ in.
- First baluster: 3.885 + 0.75 = 4.635 in, 4⅝ in from the post to its center.
- Four sections: 48 balusters, plus any extra for splits.
Widths matter. Treated 2×2s aren’t all 1½ in: Lowe’s sells one that measures 1.31 in. Twelve of those leave 4.06 in openings in the same section, so it takes 13. Measure the balusters you’re buying.
What the code asks of a guard
The IRC’s guard section (R321 in the 2024 edition, R312 in 2021 and earlier) covers railings on decks, porches and stairs:
- Where: along open sides of decks and stairs more than 30 in above the ground below.
- Height: at least 36 in on a deck (42 in in California), and at least 34 in along stairs, measured from a line through the tread nosings.
- Openings: no opening from the walking surface up to the required height may pass a 4 in sphere. That includes the gap under the bottom rail.
- Stairs: on the open side of stairs the sphere is 4⅜ in, and the triangle formed by a riser, a tread and the bottom rail of the guard must stop a 6 in sphere.
Posts carry the load
The baluster count doesn’t make a railing strong: the posts and their fastening to the framing do. Fairfax County’s typical deck details space wood guard posts no more than 6 ft apart. Kits such as Trex Transcend come in 6 and 8 ft sections; follow a kit’s instructions for its posts.
Balusters on stairs
On a stair railing the rails slope with the stairs but the balusters stand plumb. A sphere pushed through the railing goes in level, so the opening that counts is the level distance between neighboring balusters. The marks, though, go on the sloping rail, where the spacing is longer by the slope: on center along the rail equals the level on-center distance divided by the cosine of the slope.
Deckorators’ Estate aluminum balusters, ¾ in wide, show the difference. On a deck they go 4½ in on center, leaving 3¾ in openings. On stairs Deckorators spaces them 5½ in apart along the rail; on a 35° stair that is 4.51 in level, which leaves openings of 3.76 in. Enter your riser height and tread run and the calculator works out the slope, measures the openings level, and gives the spacing along the rail.
The triangle at the bottom of each step is checked separately: the bottom rail has to sit low enough over the nosings that a 6 in sphere can’t pass between it and the tread. The deck stair code guide covers the rest of the stair rules.
Baluster sizes and railing kits
| Baluster | Actual width | Fewest in a 6 ft section |
|---|---|---|
| Wood 2×2 | 1½ in | 12, 3.88 in openings |
| Treated 2×2 sold at 1.31 in | 1.31 in | 13, 3.68 in openings |
| Trex composite | 1.418 in | 12, 3.96 in openings |
| Round aluminum | ¾ in | 14, 3.87 in openings |
Fewest balusters for 68½ in between 4×4 posts 6 ft apart on center, from the method above. Widths are from the Southern Forest Products Association’s size table, the Lowe’s listing and Trex’s product profiles.
Kits are often spaced tighter than the minimum. Trex Transcend’s 6 ft sections, with 67⅝ in rails, hold 13 composite balusters; the method above needs only 12, so the kit’s openings are about 3½ in. Its 8 ft sections (91⅝ in rails) hold 18 composite or 20 aluminum balusters. When a kit tells you how many balusters go in a section, use its number: the rail’s brackets and pre-drilled holes are made for it.
The extra field adds a percentage to the total and rounds up to whole balusters. There’s no published rule for it; a few spares cover splits and the odd crooked piece. The deck stain calculator can include the railings when you finish them.
Questions people ask
How far apart should deck balusters be?
Close enough that no opening lets a 4 in sphere through (2024 IRC R321.1.3; R312.1.3 in 2021). The exact spacing depends on the length between the posts, because the openings should all be equal: with 4×4 posts 6 ft apart on center and 1½ in balusters, 12 balusters set 5⅜ in on center leave openings of 3⅞ in. On the open side of stairs the limit is a 4⅜ in sphere.
How many balusters do I need for a 6 ft or 8 ft section?
With 4×4 posts and 1½ in wood balusters, a 6 ft section (68½ in between the posts) takes 12 and an 8 ft section (92½ in) takes 17. Round ¾ in aluminum balusters need 14 and 19. Railing kits often hold more than the minimum: Trex Transcend puts 13 composite or 15 aluminum balusters in a 6 ft section and 18 or 20 in an 8 ft one. With a kit, follow its count.
Where does the first baluster go?
One opening plus half a baluster from the face of the post, measured to the baluster’s center. In the 6 ft example that’s 3⅞ + ¾ = 4⅝ in. From there, mark a center every 5⅜ in; the last opening against the far post comes out the same as the rest.
Does the 4 in rule apply under the bottom rail?
Yes. The rule covers the guard from the walking surface up to its required height, so the gap between the deck boards and the bottom rail can’t pass a 4 in sphere either. Fine Homebuilding’s balustrade guide sets the bottom rail with that in mind.
How tall does a deck railing have to be?
Guards are required where the deck is more than 30 in above the ground, and must be at least 36 in high (2024 IRC R321; R312 in 2021). California raises that to 42 in. Along stairs, guards are at least 34 in high, measured up from a line along the tread nosings.
Are stair balusters spaced differently?
They’re checked against a 4⅜ in sphere instead of 4 in, and the triangle between a riser, a tread and the bottom rail must stop a 6 in sphere. The balusters stand plumb between sloping rails, so the opening is measured level, across the balusters, while the marks are laid out along the rail. Choose Stairs in the calculator and enter the riser and run.
Sources for the numbers on this page
- California Building Standards Commission, via Codebook — 2025 California Residential Code, section R321: guards (California raises the height to 42 in) · checked October 3, 2026
- Jefferson County, Colorado — Guards: residential requirements under the 2024 IRC · checked October 3, 2026
- YellaWood — Pressure-treated balusters (baluster spacing method) · checked October 4, 2026
- Fine Homebuilding — Building and installing a site-built balustrade (Scott Grice, March 2020) · checked October 4, 2026
- Southern Forest Products Association — Southern Pine standard sizes (nominal and actual dimensions) · checked October 3, 2026
- Lowe’s — Severe Weather 2×2×42 in pressure-treated deck baluster (actual 1.31 × 1.31 in) · checked October 4, 2026
- Trex — Product profiles and measurements (baluster sizes) · checked October 4, 2026
- Trex — Transcend horizontal railing installation, THR-0422 (balusters per section, PDF) · checked October 4, 2026
- Deckorators — Estate aluminum baluster installation, sheet 8567 (11/15, PDF) · checked October 4, 2026
- Fairfax County, Virginia — Typical deck details, version 2021.0 (1/5/2024, PDF) · checked October 4, 2026
Corrections and updates are logged on the sources page.