Railing & Baluster Spacing Calculator

Enter your railing length to get post count, baluster count per section, actual spacing, and total rail count — with automatic IRC 4" sphere rule checking. All inputs saved in the URL.

Railing Layout

Total linear footage of railing on all sides. For a deck, add up all open sides.

How far apart your railing posts sit. 6 ft is the most common residential spacing.

Baluster Spacing

Width of each baluster (the vertical spindles). Standard square balusters are 1.5".

Max gap between balusters. IRC requires < 4" (sphere rule). Capped at 4" automatically.

Rails

Number of horizontal rails per section. Most systems use a top and bottom rail (2 total).

↓ How the math works

Enter total railing length to see your material list.

Shopping List

Enter railing length to generate a shopping list.

Important: Minimum railing height for residential decks ≥ 30" above grade is 36" (IRC R312). Local codes may require 42". Verify with your building department. See our code requirements guide.

Methodology

How the baluster calculator works.

Posts and sections

Posts = ⌈ length ÷ post spacing ⌉ + 1. Each span between two posts is one section. Sections = posts − 1.

Balusters per section

For each section (in inches): n = ⌈ (sectionLength − maxGap) ÷ (balusterWidth + maxGap) ⌉.

The actual gap after spacing n balusters evenly: gap = (sectionLength − n × balusterWidth) ÷ (n + 1). This gap is always ≤ the requested max gap.

IRC 4" sphere rule

The calculator hard-caps the maximum gap at 4 inches — the IRC requirement that a 4-inch sphere cannot pass through any railing opening. The actual gap displayed is what passes inspection, assuming your posts are also properly spaced and anchored.

Rails

Total rails = sections × rail rows. If your railing system uses 2 rails (top and bottom), multiply sections by 2. Most residential wood railing systems need 2 horizontal rails per section.

FAQ

Frequently asked questions.

What is the 4-inch sphere rule for balusters?

The IRC requires that a 4-inch sphere cannot pass through any opening in a railing. This means the gap between any two balusters — or between a baluster and a post — must be less than 4 inches. This calculator enforces a hard maximum of 4" and displays the actual calculated gap so you can verify compliance.

What is the minimum railing height for a residential deck?

IRC Section R312 requires guards (railings) on decks 30 inches or more above grade. The minimum height for residential guards is 36 inches. Some local codes require 42 inches. This calculator outputs railing linear footage; height is specified separately in your railing system.

How are balusters calculated per section?

For each section between posts: balusters = ⌈(section length − max gap) ÷ (baluster width + max gap)⌉. The calculator then computes the actual equal gap that results, ensuring it never exceeds the IRC 4" maximum.

What is a typical post spacing for deck railings?

Most railing systems use posts spaced 4–8 feet on center, with 6 feet being common. This calculator defaults to 6 feet. The maximum post spacing depends on your railing system's structural rating — composite and aluminum systems often allow up to 8 feet.

Can I use this as a baluster spacing calculator?

Yes — that is exactly what the per-section calculation does. Enter your total railing run and post spacing to get the baluster count per section and the exact gap between each baluster.

Can I save my railing calculation?

Yes — all inputs are saved in the URL. Bookmark the page or share the link to save your exact calculation.