Guards · IRC R312

Deck Railing & Baluster Calculator

Enter your railing runs. Get the posts, the fewest balusters that keep every gap under 4 inches, the exact on-center spacing and the rails to buy.

1 Railing runs
ft
Outside of end posts
ft
ft
ft
0 to skip
2 System
Center to center. Follow your system’s rating
Code: a 4″ sphere must not pass
Balusters
81
3 3/4″ max gap
Posts
10
Corners counted once per run end
Sections
7
40′ total
Rails
7
3×10′, 4×12′ (top + bottom)
Guards are required where the deck is more than 30″ above grade within 36″ of the edge. They must be at least 36″ high, and a 4″ sphere must not pass through any opening (IRC R312). Many jurisdictions require 42″ on some buildings, so check locally.

Where two runs meet at a corner they can share a post. Subtract one post per shared corner: 8 posts if the runs form one continuous rail.

RunSectionsClear per sectionBalusters / sectionGap
1: 16′359 5/16″113 9/16″
2: 12′266 3/4″123 3/4″
3: 12′266 3/4″123 3/4″

One section, to scale

run 1
4″ sphere59 5/16″ between posts · 11 balusters · 3 9/16″ gaps

Laying out balusters so the gaps come out even

Never start at one post and step across at a fixed spacing. You end up with an odd gap at the far post. Work out the clear distance between posts, then find the fewest balusters that keep every gap under your limit. With n balusters of width b in a clear space C, every gap is (C − n × b) ÷ (n + 1).

Mark the first baluster one gap in from the post, then mark each next one at gap + b on center. A spacer block cut to the gap width makes installation fast and consistent.

Guard rules worth knowing

  • Height: 36″ minimum on decks under the IRC, measured from the decking to the top of the rail. Some jurisdictions, and commercial buildings, require 42″.
  • Openings: a 4″ sphere must not pass anywhere. On stairs, the triangle between the tread, riser and bottom rail may pass a 6″ sphere, and the rest of the stair guard a 4⅜″ sphere.
  • Strength: guards must resist a 200 lb concentrated load at the top. Notched 4x4 posts lag-screwed to the rim usually fail that test. Use through-bolts with blocking or tested post brackets.

Worked example: a 16 × 12 ft deck with a stair opening

Railing runs along the two 12 ft sides and the 16 ft outer edge, minus a 36 in. stair opening: 12 + 12 + 16 − 3 = 37 ft. With posts no more than 6 ft apart (a common limit for wood guard posts) that is about eight sections. At roughly 2.4 balusters per foot for 2×2s spaced at 5 in. on center, plan for around 90 balusters, then let the calculator count each section exactly, because posts at corners and openings change the numbers.

Choosing a railing system

  • Wood (2×2 balusters, 2×4 rails, 4×4 or 6×6 posts): cheapest and fully DIY; needs stain or paint.
  • Metal balusters in wood rails: thinner balusters improve the view; count goes up because each is narrower.
  • Composite or aluminum kits: sold by section length with brackets; follow the kit’s post spacing exactly, since its strength depends on it.
  • Cable and glass: require tensioning or engineered panels; the 4 in. sphere rule still applies when the cable is pushed.

Post attachment is the weak link

A guard must resist a 200 lb load at the top (IRC Table R301.5). Most failures happen where the post meets the rim joist, not in the balusters. Through-bolt posts and use blocking or tested hardware as shown in DCA 6, rather than notching posts deeply or relying on lag screws alone. For exact gaps in a single section, use the baluster spacing calculator.

Ordering

Buy balusters by the count per section, not by total length, and add a few spares for splits and warped pieces. Rails come in 8, 10, 12 and 16 ft lengths; with posts about 6 ft apart, a 12 ft rail spans two sections, which reduces joints. Post caps and hardware are per post, so count posts first.

Questions people ask

How many balusters do I need per foot?
With 2x2 wood balusters (1½″ actual) and gaps just under 4″, plan on a little over two balusters per foot of clear railing. A 6 ft section between 4x4 posts (about 68½″ clear) needs 13 balusters for gaps of 3.5″.
What is the maximum baluster spacing for deck railings?
The IRC requires that a 4″ sphere cannot pass through any opening in a guard (R312.1.3). Builders aim for 3½″ to 3¾″ clear gaps, which leaves room for boards to shrink or bow.
When is a deck railing required?
When the walking surface is more than 30″ above the grade below, measured within 36″ horizontally of the edge (IRC R312.1.1). The guard must then be at least 36″ high.
How far apart should railing posts be?
Wood guard posts are commonly spaced 6 ft on center or less. Manufactured railing systems are tested at specific spacings, often 6 or 8 ft, so follow the system’s instructions.

Related calculators

All deck tools →