Wood Deck Railing Calculator: How Many Balusters, Posts & Rails You Need

· By DIY Calc

Quick answer: For 1.5-inch square wood balusters with a 3.5-inch gap (the code-compliant sweet spot), you need one baluster every 5 inches — approximately 14 balusters per 6-foot section. Posts go every 6 to 8 feet. Rails run the full length between posts.

Skip the math — use our free Deck Railing Calculator →

Understanding the 4-Inch Spacing Rule

The most important number in deck railing design is 4 inches. Building codes — based on the International Residential Code (IRC) and adopted by most US jurisdictions — require that a 4-inch sphere cannot pass through any opening in a deck railing. This rule exists to prevent small children from getting their heads trapped between balusters.

In practice, this means your gap between balusters must be less than 4 inches. Most builders use 3.5 inches as the standard gap — it keeps you comfortably under the limit while maximizing space between balusters. Using a narrower gap like 3 inches is also fine but requires more balusters.

Bottom gap: The same 4-inch rule applies to the gap between the deck surface and the bottom rail. The bottom of your bottom rail must sit no more than 4 inches above the decking.

The Baluster Count Formula

Here is the formula used by every deck builder to calculate the number of balusters for any section:

Number of balusters = (Section length − gap) ÷ (baluster width + gap) Then round UP to the next whole number. Verify actual gap: (Section length − (N × baluster width)) ÷ (N + 1) Must be less than 4 inches.

Worked Example: 8-Foot Section, 1.5" Balusters, 3.5" Target Gap

Section length: 96 inches (8 feet)

Baluster width: 1.5 inches (standard 2x2 actual dimension)

Target gap: 3.5 inches

Step 1: (96 − 3.5) ÷ (1.5 + 3.5) = 92.5 ÷ 5 = 18.5 → 19 balusters

Step 2 — Verify actual gap: (96 − (19 × 1.5)) ÷ (19 + 1) = (96 − 28.5) ÷ 20 = 67.5 ÷ 20 = 3.375 inches

Result: 19 balusters with actual 3.375-inch gaps. Code compliant.

Quick Reference: Balusters Needed by Section Length

Section Length1.5" Baluster / 3.5" Gap1.5" Baluster / 3" GapActual Gap (3.5" target)
4 ft (48")9 balusters11 balusters3.45"
6 ft (72")14 balusters16 balusters3.4"
8 ft (96")19 balusters22 balusters3.37"
10 ft (120")24 balusters27 balusters3.35"
12 ft (144")28 balusters33 balusters3.41"

Post Spacing and Sizing

Railing posts provide the structural backbone of the system. They must be spaced correctly both for code compliance and to keep the rail rigid under lateral load (200 lbs per the IRC).

Post Spacing Rules

Post Sizing

Deck HeightMinimum Post SizeNotes
Up to 6 feet4x4 (3.5" actual)Standard for most residential decks
6 to 14 feet4x6 or 6x6Larger post required for added height leverage
14+ feet6x6 minimumConsult structural engineer

Post Attachment Methods

Through-bolt to rim joist is the strongest method — two 1/2-inch galvanized carriage bolts through the post and rim joist. This is the preferred method for most code inspectors. The post sits against the outside of the rim joist with the deck surface notched around it, or the post is surface-mounted beside the decking.

Post base hardware (Simpson Strong-Tie and similar brands) mounts a steel base to the deck framing, into which the post inserts and is secured with bolts. Easier to install than through-bolts but check that your jurisdiction accepts this method.

Avoid embedding posts directly in concrete or driving them into the ground for railings — this creates rot pockets and fails inspection in most jurisdictions.

Rail Sizing and Layout

Most wood deck railings use a top rail and a bottom rail between posts, with balusters running vertically between them.

Wood Material Options for Deck Railing

Pressure-Treated Pine

$15 to $25 per linear foot installed

The standard choice for budget-conscious builds. Ground-contact rated PT lumber (UC4B treatment) is required for posts. Above-deck rails and balusters can use Above-Ground (UC3B) treatment. Needs sealing or painting within the first year and recoating every 2 to 3 years. May twist and check as it dries — use kiln-dried after treatment (KDAT) material to minimize this. Lifespan: 15 to 25 years with maintenance.

Cedar

$25 to $40 per linear foot installed

Naturally rot-resistant, dimensionally stable, and visually attractive. Lighter weight than PT pine and less prone to warping. Western red cedar is the most common variety. Weathers to a silver-gray if left unfinished — apply a clear sealer to maintain color. Cedar balusters are significantly more expensive than PT but require less ongoing maintenance. Lifespan: 20 to 30 years.

Redwood

$35 to $55 per linear foot installed

The premium natural wood option. Naturally resistant to rot, insects, and splitting. Beautiful grain and color that weathers gracefully. Increasingly expensive and less widely available than cedar. Best suited for high-end projects in the Pacific Southwest where it is locally sourced. Lifespan: 25 to 40 years.

Composite Balusters with Wood Rails

$35 to $60 per linear foot installed

A popular hybrid approach: use composite (PVC or wood-fiber composite) balusters that need no painting or staining, combined with wood rails and posts that are painted or stained. Composite balusters are available in many profiles and colors. They will not rot, splinter, or require refinishing. Most major composite brands (Trex, TimberTech, Fiberon) sell matching baluster systems for their decking products.

Cable Railing (Stainless Steel Cables)

$60 to $120 per linear foot installed

Horizontal stainless steel cables run between beefier wood or metal posts. Cable spacing must comply with the 4-inch rule — most systems use 3-inch spacing between cables. Posts must be substantially larger (typically 4x6 or 6x6) and closer together (maximum 4 to 6 feet) to handle cable tension. The reward is an essentially maintenance-free, view-preserving railing. Popular on waterfront decks.

Complete Materials List for a Typical 40-Linear-Foot Deck Railing

Example: 12x16 deck, railing on three sides, 36-inch height, pressure-treated wood, 6-foot post spacing.

ItemQuantityNotes
4x4 posts (10 ft lengths, cut to height)8 to 10 piecesThrough-bolt to rim joist
2x6 top cap rail42 linear feet10% waste factor added
2x4 bottom rail42 linear feet10% waste factor added
2x2 balusters (36" or 42" long)~96 piecesApprox 2.4 per linear foot at 3.5" gap
Structural screws (3" deck screws)5 lb boxStainless or hot-dipped galvanized
1/2" carriage bolts (4" length)20 sets2 per post for rim joist attachment
Exterior wood sealer or primer/paint2 gallonsCovers all wood surfaces

Get Your Exact Count

Enter your railing dimensions and our calculator does the math — balusters, posts, rails, and cost estimate.

Open the Deck Railing Calculator →

Building Code Summary

For related guides, see our articles on deck railing installation overview, how much deck stain you need, and shed building materials and cost. Use our free railing calculator to get a precise materials list for your specific dimensions.