Deck Railing Calculator

To plan a deck railing, divide each section by the 6 ft maximum post spacing and round up for the bays, add one for the posts, then fill each bay with balusters spaced so no opening passes a 4-inch sphere, with a top and bottom rail per bay and a cap along the run. 40 ft of guard in 2 sections needs 10 posts, 88 balusters at 3.26-inch gaps, 16 rails, 40 ft of cap, 270 screws and 20 post bolts.

Units

All the edges that get a guard, added up.

Straight runs, each with a post at both ends.

A guard is required above 30 in.

The most you want; openings must stay under 4 in.

Your materials

Results update as you type.

Posts
10 posts
4 × 4
Balusters
88 balusters
2 × 2, 3.26 in gaps
Rail cap
40 linear ft
2 × 6 or 5/4

How it adds up

  1. Posts 10 posts

    Each section is 240 in: ÷ 72 in maximum spacing = 3.33, rounded up to 4 bays, so 5 posts 5 × 2 sections = 10

  2. Balusters 88 balusters

    Bay between posts: (240 in − 5 × 3.5 in) ÷ 4 = 55.63 in (55.63 in − 3.5 in) ÷ (1.5 in + 3.5 in) = 10.43, rounded up to 11 per bay, leaving 3.26 in gaps 11 × 8 bays = 88

  3. Rails 16 rails

    A top and a bottom rail in each of 8 bays = 16, 74.17 ft in all

  4. Rail cap 40 linear ft

    One cap along the whole 40 ft run

  5. Screws 270 screws

    Rails: 16 × 2 ends × 2 #8 screws = 64 Cap: 10 posts × 3 #12 screws = 30 Balusters: 88 × 2 #8 screws (one top, one bottom) = 176 Posts: 10 × 2 half-inch through-bolts with washers = 20

  6. Code checks Pass

    The deck is 36 in above grade, over 30 in, so a guard is required. Openings of 3.26 in will not pass a 4 in sphere. Guard height: 36 in minimum, measured from the deck surface.

Estimates only. Results come from the formulas listed below and use no outside data. Check local building codes and your supplier before buying.

One bay of your railing

Front view of one railing bay 55.63 in wide between two posts, with 11 balusters leaving gaps of 3.26 in. Bay 55.63 in between posts
  • 11 balusters in each bay, 3.26 in apart
  • 5 posts in each section, 8 bays in all
  • Drawn 36 in high, the guide's minimum
Embed this calculator on your site

Paste this where you want the calculator. It is free, shows no ads, works in any site, and links back to this page. Change the height to suit your layout.

What do I need to enter?

  1. The total length of railing, every edge that gets a guard added together.
  2. How many separate straight sections that is; each gets a post at both ends.
  3. How high the deck surface is above the ground, which decides whether a guard is required at all.
  4. The widest gap you want between balusters, under 4 inches.

How are railing posts, balusters and rails counted?

Assumptions

Worked example

40 ft of guard in 2 sections on a deck 36 inches above grade, 3.5-inch gaps wanted:

What are the code requirements for deck railing?

From the American Wood Council's deck guide, which cites IRC R312.1. Your local code may amend them.

What does this calculator leave out?

FAQ

How far apart should deck railing posts be?

At most 6 ft on center for the 4 × 4 posts in the American Wood Council's example guard. A 20 ft section therefore needs 5 posts (240 ÷ 72 = 3.33, rounded up to 4 bays, plus one), and 60 ft in 3 sections needs 15. Posts for a required guard must be through-bolted to a joist or rim joist of at least 2 × 8.

How many balusters do I need?

Enough that no opening passes a 4-inch sphere: with 1.5-inch balusters and a 3.5-inch gap, each 55.63-inch bay takes 11, so the 40 ft example takes 88. A smaller gap means more balusters; the calculator spaces them evenly and tells you the gap you actually get.

How high does a deck railing have to be?

36 inches at least, measured from the deck surface, in the guide's example guard. A guard is required at all once the deck is more than 30 inches above grade; a 24-inch deck needs none, though many owners add one anyway. The guide gives that threshold twice: its stair figure (Figure 30) says a total rise of 30 inches or more, while its Guard Requirements and IRC R312.1.1 say more than 30 inches above grade, so at exactly 30 inches ask your building department.

What is the maximum gap between deck balusters?

Openings in the guard may not allow a 4-inch sphere to pass, so the clear gap must be under 4 inches. The 40 ft example asks for 3.5 inches and ends up at 3.26 once the balusters are spaced evenly. Triangular openings at stairs have their own 6-inch sphere limit.

What size posts and rails does a deck railing use?

The guide's example uses 4 × 4 posts, 2 × 4 top and bottom rails, 2 × 2 balusters and a 2 × 6 or 5/4 cap. Posts are not notched, and they bolt through to a joist or rim joist of at least 2 × 8 with two half-inch bolts and washers. For a required guard up to 36 inches high the posts also need hold-down anchors with at least 1,800 pounds of allowable tension, which this calculator does not count.

How many screws does a deck railing need?

270 for the 40 ft example: 64 at the rail ends (two #8 screws at each end of each rail), 30 for the cap (three #12 screws per post) and 176 for the balusters (one #8 screw top and bottom), plus 20 through-bolts for the posts. The figure allows threaded nails instead of the screws at each of those places.

How many balusters for an 8 ft rail section?

16 with 1.5-inch balusters and 3.5-inch gaps: an 8 ft section takes 3 posts (96 ÷ 72 = 1.33, rounded up to 2 bays), each bay is 42.75 inches between posts and takes 8 balusters, leaving 3.42-inch gaps. Enter 8 ft and 1 section above to change the gap.

The deck joist calculator sizes the rim joist these posts bolt to, and the deck stain calculator takes the railing's area as extra area to coat.

Sources

The counts are arithmetic. Every guard rule on this page comes from these publications. Follow them and your local building code over this page where they differ.

Every publication the site cites is listed on the methodology page, with how the numbers are computed and checked. Found a mistake? Send a correction. The About page explains who runs DeckTally.

More deck calculators

Last reviewed . Built and checked by Hassan Razeen.