Railing Calculator — ft, balusters, posts, cost

Dimensions in feet, inches · Balusters, posts, rails · IRC R312.1 compliant · Cost estimate
IRC R312.1
Switch to Metric version →

How to use this calculator

Enter your total railing length, choose railing height (36" for deck, 42" for stairs or elevated decks), select baluster size and spacing, and configure post spacing. The calculator counts balusters, posts, rail lengths, and hardware.

IRC R312.1 — maximum 4" sphere gap between balusters. The calculator enforces this.
Sections — choose straight, L-corner, or stair (angled) layouts.
Post spacing — typically 6–8 ft on center for structural integrity.

20 ft Deck Rail 40 ft Deck Perimeter 12×16 L-Corner Deck 8 ft Stair Run (42") 24 ft Porch Rail 10 ft Balcony (42") 3" Tight Gap
Railing Layout
Dimensions
ft in
%
Railing Diagram · tap labels to focus inputs
Railing Elevation
$Cost Estimate
$
$
$
$
Materials Summary
Posts
pcs
Balusters
pcs
Top Rail Length
lin ft
Bottom Rail Length
lin ft
Top Rail Pieces (8 ft)
pcs
Bottom Rail Pieces
pcs
Post Caps
pcs
Baluster Spacing (actual)
in
Rail Brackets
pcs

Saved Calculations

TimeLengthHeightPostsBalustersCost
No saved calculations

How to Calculate Railing Materials

Railing takeoffs work backward from total run length. Posts are set first at 6–8 ft on center, then each post-to-post bay is filled with balusters spaced to keep a 4" sphere from passing the gap. Order top and bottom rails by the lineal foot in 8 ft stock, add one post cap per post, and apply 10–15% waste because rail offcuts and baluster trimming are unavoidable. Pressure-treated 4×4 posts and 2×4 rails are the deck standard; size from a board feet lumber calculator if you are buying rough stock.

How to use this calculator

Pick the layout (straight, L-corner, or stair run), enter the railing length in ft/in, set height (36" deck guard, 42" for elevated walking surfaces and stairs), then choose baluster size and gap. The actual gap output shows the even spacing the calculator distributes per bay so no single opening exceeds code. Use it alongside the deck calculator for the framing and a fence calculator for similar post-and-infill runs.

Formulas Used

Posts: ⌈total length / post spacing⌉ + 1 (+ corner posts for L-layouts)
Balusters per bay: ⌊(bay clear span − post width) / (baluster width + gap)⌋
Rail length: total railing length × (1 + waste), divided into 8 ft pieces
Actual gap: (clear span − n × baluster width) / (n + 1), capped at the 4" code limit

Building Code Reference

IRC R312.1.1: Guards required where the walking surface is > 30" above grade; minimum height 36". IRC R312.1.3: A 4" sphere must not pass through any opening between balusters. IRC R312.1.2: Stair guards minimum 34" measured from the nosing. Posts and the assembly must resist a 200 lb concentrated lateral load per IRC R301.5.

On install day

What gets missed on the takeoff. Rail brackets and connectors — the calculator counts 2 brackets per rail-to-post connection, so a single-rail run with 5 posts is ~16 brackets at $2–4 each; PT deck-rail kits in 2025 run roughly $25–45/lf installed for wood, $55–120/lf for composite or aluminum. Post bases & through-bolts — surface-mount 4×4 bases (Simpson APB44/DTT2Z) plus ½" through-bolts are required by IRC R507.5 on decks; do not toe-screw posts to a rim joist. Stair length — a stair run measured along the slope is roughly 1.15× the horizontal run for a 7/11 stair, so order rails to the slope length, not the floor distance. Save the run to History and export with the diagram to share with the lumberyard.

FAQ

What is the maximum baluster spacing? The clear gap between balusters must reject a 4" sphere. With 1.5" balusters a 3.5" gap gives a safe margin for wood movement; 4" is the absolute code maximum.

How far apart should railing posts be? Typically 6–8 ft on center. Closer spacing stiffens the run. If posts also carry stair stringers or beams, coordinate with the floor joist span calculator and stud layout from the stud wall calculator.

Building in metric? Switch to the metric railing calculator for mm dimensions and EN 1991-1-1 (100 mm sphere) compliance.

Misha Noyr, M.Eng.

Misha Noyr, M.Eng.

Civil Engineer · 15+ yrs · structural design, geotechnics. Full bio →