Deck Railing Calculator

This free deck railing calculator turns one length into a complete guard take-off. Enter the total run of level railing, pick your post size and spacing, choose a baluster style, and it counts posts (one per bay plus one per corner), balusters spaced so no 4-inch sphere passes, top and bottom rails, an optional 2×6 cap rail, deck screws, rail connectors, and a code-required hold-down at every post. For 1½-inch square balusters at a 4-inch gap that lands near the jobsite rule of thumb of about two balusters per linear foot.

The spacing math is the part people get wrong. IRC R312.1.3 says no opening in a level guard may pass a 4-inch sphere, so the calculator solves for an even gap under 4 inches across each bay and reports the exact result. Stairs use a looser 4-3/8-inch sphere on the rake plus a 6-inch sphere at the tread triangle, and they need a separate graspable handrail 34–38 inches high (IRC R311.7.8) — enter the stair rake length and those get counted too. Cable rail switches to horizontal runs at 3 inches or tighter, because cable deflects.

The other quiet code item is attachment: a guard that passes the sphere test still fails inspection if the posts are only screwed to the rim. IRC Table R301.5 puts a 200-pound concentrated load at the top, so the calculator budgets a tension-tie or through-bolt hold-down at every post and follows AWC DCA 6 for post size and spacing. No pricing, no signup — just the materials list. Confirm your local amendments, which most often raise the guard to 42 inches.

View material estimation guides →

Deck Railing Calculator

Get a complete deck railing take-off — posts, balusters, rails, cap, and the fasteners and hold-downs to attach them — from one length. Balusters are spaced so no 4″ sphere passes (IRC R312.1.3), posts follow AWC DCA 6, and every post gets a hold-down for the 200 lb code load. Handles wood, metal, and cable infill, plus stair railing. Free, no signup.

Railing length & posts

Total length of level guard railing (sum every guarded side — skip the house wall and any gate openings). Posts round up and add one per corner; verify against your post layout.

Guard height & infill

IRC R312.1.2 sets a 36″ minimum guard on decks. The infill is spaced so no 4″ sphere can pass (IRC R312.1.3).

Rails & caps

Top and bottom rails run the full length. Add a top cap rail (2×6) to walk drinks along, and decorative post caps.

Stairs (optional)

Length of guard along the stair rake (the slope), if any. Stair guards use a 4-3/8″ sphere and need a graspable handrail (IRC R311.7.8).

Plan disposal before you start

Smaller jobs still produce more debris than a few trash bags can hold. Check what's allowed in a dumpster and which disposal option fits the scope.

See disposal options →

Related Calculators

Explore Decks & Fences: calculators, diagrams & guidesEvery calculator, cross-section diagram, and guide for this trade in one place.

How to Use This Calculator

  1. Enter the total length of level deck railing — add up every guarded side, and skip the house wall and any gate openings.
  2. Set the number of 90° corners and pick your post size (4×4 or 6×6) and maximum post spacing (6 ft is typical for a 4×4).
  3. Choose the guard height (36 in. IRC minimum, or 42 in. where required) and a baluster or infill style — wood, metal, or cable.
  4. Pick the maximum baluster gap; 4 in. is the IRC level-guard limit, or tighten to 3½–3¾ in. for a kid-safe deck.
  5. Turn the top cap rail and post caps on or off, and enter a stair rake length if your deck has stairs.
  6. Click Calculate to get posts, balusters at the exact even gap, rails, cap, fasteners, hold-downs, and stair railing — then check the code notes.

What this calculator does and does not include

This calculator sizes the guard (railing) itself — posts, balusters or cable, top and bottom rails, an optional cap, the fasteners, and a hold-down at every post — under the residential rules of IRC R312 and the AWC DCA 6 deck guide. It does not size the deck framing (use the Deck, Joist Span, and Deck Beam Span calculators for that), it does not include stair stringers or treads (use the Stairs calculator), and it is a prescriptive material take-off, not an engineered design. Guard height, post attachment, and cable spacing are the most commonly amended items at the local level, so confirm with your building department before ordering — an inspector can reject a finished guard that misses a local amendment. Post counts round up and add one per corner; verify the total against your actual post layout.

Frequently Asked Questions

How many balusters do I need for my deck railing?

The rule of thumb is about two balusters per linear foot of railing for standard 1½-inch square balusters at a 4-inch gap, so ~80 for a 40-foot deck. The exact count comes from the spacing rule, not the rule of thumb: IRC R312.1.3 says no opening may pass a 4-inch sphere, so for each bay (the clear opening between two posts) the calculator solves N = ⌈(opening − 4) ÷ (baluster width + 4)⌉ and checks that the resulting even gap is under 4 inches. Narrower metal balusters (½–¾ inch) need more pieces per bay; wider posts and tighter gaps also raise the count.

What is the maximum spacing between deck balusters?

A 4-inch sphere must not pass through a level deck guard (IRC R312.1.3), so balusters are spaced to keep every gap at or under 4 inches. With 1½-inch square balusters that means an on-center spacing of about 5½ inches. On the stair rake the limit loosens to a 4-3/8-inch sphere, and the triangular opening at the tread, riser, and bottom rail may pass a 6-inch sphere. Many builders tighten level-guard gaps to 3½–3¾ inches on decks used by small children — the code number is a maximum, not a target.

How far apart should deck railing posts be?

The IRC does not give a single number, but the AWC DCA 6 prescriptive deck guide keeps 4×4 guard posts within about 6 feet, and 6×6 posts for taller guards or longer spans. Closer is stronger. The reason spacing matters is the load: IRC Table R301.5 requires the guard to resist a 200-pound concentrated load at the top, and a 4×4 anchored with a proper hold-down at 6 feet is the tested limit. Space posts evenly, add one at every corner and at each end, and put one wherever a stair meets the deck.

How tall does a deck railing have to be?

IRC R312.1.2 requires a guard at least 36 inches high on decks, measured vertically from the deck surface to the top of the rail. A guard is required in the first place wherever the walking surface is more than 30 inches above the grade or floor below (R312.1.1). Many jurisdictions — and all commercial work — require 42 inches, so confirm locally before you buy posts and balusters. Taller guards change the baluster length and sometimes add a mid-rail; the calculator lets you pick 36 or 42 inches.

How do I attach deck railing posts so they pass inspection?

This is the most-failed part of a deck guard. Screwing or lagging a post to the rim joist does not resist the code load — IRC Table R301.5 applies a 200-pound force at the top, which levers hard on the base. DCA 6 and most inspectors require a tested hold-down (a tension tie such as a Simpson DTT2Z) or through-bolts with blocking at every guard post. The calculator budgets one hold-down per post for exactly this reason. Notching posts is limited without engineered hardware, so follow the DCA 6 tension-tie details.

How is cable railing spaced on a deck?

Cable rail uses horizontal runs instead of vertical balusters, spaced at 3 inches or tighter — not 4. Even though a 3-inch spacing technically clears the 4-inch sphere, cable deflects when pushed, so most building departments require ≤3-inch spacing and intermediate pickets or supports on runs longer than about 4 feet to hold tension. The calculator counts runs as ⌊(guard height − 4) ÷ 3⌋ and tallies the tensioner and end fittings. Some family-housing codes discourage horizontal (ladder-effect) infill entirely, so check locally.

What does this calculator not include?

It sizes the guard itself — posts, balusters or cable, top and bottom rails, an optional cap, fasteners, and a hold-down per post — plus stair railing if you enter a rake length. It does not size the deck framing (use the Deck, Joist Span, and Deck Beam Span calculators), it does not include stair stringers or treads (use the Stairs calculator), and it is a prescriptive material take-off, not an engineered design. Post counts round up and add one per corner, so verify against your actual layout, and always confirm local code amendments before ordering.