Reviewed and updated: August 2026
Calculate balusters, posts, rail length, and cost for any staircase or deck railing. Includes IRC code spacing check to ensure balusters meet the 4-inch maximum clear spacing requirement.
Enter your stair run, baluster size, spacing, and material costs to get a complete railing materials estimate. Always verify requirements with your local building department before installation.
The IRC requires that no opening in a guardrail or balustrade allow a 4-inch sphere to pass through. This is the governing dimension for baluster spacing, it is not a suggestion, and it applies to both stair railings and deck guardrails.
The basic baluster count formula is:
Number of balusters = railing length (in) / (baluster width + desired spacing)
Round up to the next whole number. For example, a 12-foot run (144 inches) with 1.5-inch square balusters at 3.5-inch spacing: 144 / (1.5 + 3.5) = 144 / 5 = 28.8, rounded up to 29 balusters.
Rounding up the baluster count changes the actual clear spacing. After rounding, recalculate the actual spacing to confirm code compliance:
Actual clear spacing = (run length - (balusters x baluster width)) / (balusters + 1)
Using the example above: (144 - (29 x 1.5)) / (29 + 1) = (144 - 43.5) / 30 = 100.5 / 30 = 3.35 inches clear. This passes the 4-inch maximum. The calculator performs this check automatically and flags any spacing that exceeds 4 inches.
To get perfectly even spacing across the run, divide the total space equally across all bays. Adjust by one baluster up or down and compare the resulting spacing, choose the count that gives the most even distribution while staying under 4 inches clear.
The IRC sets different height requirements for handrails (the graspable member you hold) and guardrails (the barrier that prevents falls). These are separate requirements and both must be met on a staircase with a guardrail system.
| Railing Type | IRC Minimum Height | Measured From | Notes |
|---|---|---|---|
| Stair handrail | 34 inches minimum, 38 inches maximum | Stair nosing (vertically) | Required on stairs with 4 or more risers |
| Stair guardrail | 36 inches minimum | Stair nosing (vertically) | Required where drop exceeds 30 inches |
| Landing / deck guardrail | 36 inches minimum | Walking surface | Required where drop exceeds 30 inches |
| Commercial guardrail | 42 inches minimum | Walking surface | IBC requirement, not IRC residential |
The 34 to 38 inch handrail height range applies to the graspable handrail measured vertically above the stair nosing, not measured perpendicular to the slope. This distinction matters on steep stairs where the two measurements can differ significantly. Always measure vertically.
Material selection affects cost, maintenance, durability, and the baluster spacing calculation since different materials have different standard widths.
| Material | Typical Baluster Width | Lifespan | Maintenance | Notes |
|---|---|---|---|---|
| Pressure-treated wood | 1.5 inches (2x2) | 15 to 25 years | Paint or stain every 2 to 4 years | Most common for exterior stairs and decks |
| Cedar or redwood | 1.5 inches (2x2) | 20 to 30 years | Seal every 2 to 3 years | Better rot resistance than PT; higher cost |
| Wrought iron / steel | 0.75 to 1 inch (square) | 30 to 50 years | Touch up paint as needed | Requires professional welding for custom work |
| Aluminum | 0.75 to 1 inch (square) | 20 to 40 years | Minimal, powder coat resists corrosion | Lightweight; good for coastal environments |
| Cable railing | 3/16 to 1/4 inch diameter | 20 to 30 years | Tension check annually | Horizontal cables must meet 4-inch spacing rule |
| Composite / PVC | 1.5 inches | 25 to 30 years | Minimal, clean periodically | No painting; may expand in heat |
| Glass panels | N/A (continuous panel) | 20 to 30 years | Clean periodically | Tempered safety glass required; no baluster count needed |
Newel posts and guardrail posts are the structural anchors of any railing system. Baluster spacing compliance means nothing if the posts are not properly attached, a post that fails under load is a fall hazard regardless of how well the balusters are spaced.
Newel posts are required at the bottom of each stair run, at the top, and at any intermediate landing. They must be capable of resisting a 200-pound concentrated load applied in any direction at the top of the post per IRC requirements. Through-bolting a newel post to the stringer or framing below is the strongest attachment method. Surface-mount post anchors are faster to install but provide less resistance to lateral loading.
Deck guardrail posts should be spaced no more than 6 to 8 feet on center. Posts mounted on top of the decking surface (surface mount) provide less resistance to lateral loads than posts that extend through the decking and attach to the rim joist or structural framing below. For decks over 30 inches above grade, through-framing post attachment is strongly preferred and required by many local jurisdictions.
For wood railing systems, 4x4 posts are standard for deck guardrails up to 36 inches high. Taller railings (42 inches) or longer post spans (over 6 feet) typically require 4x6 or 6x6 posts to meet the load requirements. Metal post sizing is specified by the railing system manufacturer.
The IRC specifies that a handrail must be graspable, meaning a person can wrap their hand around it and maintain a firm grip while descending. This rules out flat 2x6 boards used as handrails, which are common in older construction but do not meet current code.
Material costs for a basic pressure-treated wood railing system run $15 to $30 per linear foot. Composite and aluminum systems run $40 to $80 per linear foot. Cable railing runs $60 to $150 per linear foot including hardware. Glass panel systems start at $100 per linear foot and up. Professional installation adds $20 to $50 per linear foot in labor depending on material and complexity.
For the lumber needed for a wood railing system, use our lumber calculator. For total project budgeting, see our project cost estimation guide.
Baluster count and spacing are governed by the IRC 4-inch sphere rule. The diagram shows how baluster width, clear spacing, and the number of bays relate to each other along a stair run.
4-inch maximum clear space between balusters (IRC R312.1.3) · Count = run ÷ (width + spacing), round up · Recalculate actual spacing after rounding
Handrail height and guardrail height are governed by separate IRC sections and measured from different reference points. Both must be met simultaneously on a typical staircase with a guardrail system.
| Railing Type | Location | Required Height | Measured From | IRC Section |
|---|---|---|---|---|
| Handrail (graspable) | Stairs | 34"–38" above nosing | Stair nosing, vertically | R311.7.8 |
| Guardrail (barrier) | Stair side | 36" minimum | Stair nosing, vertically | R312.1.3 |
| Guardrail | Deck ≤30" above grade | 36" minimum | Deck surface | R312.1.2 |
| Guardrail | Deck over 30" above grade | 42" minimum | Deck surface | R312.1.2 |
| Handrail | Ramp | 34"–38" | Ramp surface | R311.8.3 |
| Graspability | All handrails | 1.25"–2" diameter or equivalent | N/A | R311.7.8.3 |
| Material | Cost (per baluster) | Lifespan | Maintenance | Best For |
|---|---|---|---|---|
| Pressure-treated wood (1.5" sq) | $2–$5 | 15–20 years | Paint or stain every 3–5 years | Exterior decks, most economical |
| Cedar / redwood (1.5" sq) | $4–$8 | 20–25 years | Stain every 3–5 years | Natural appearance; better than PT aesthetically |
| Composite (2" sq) | $8–$20 | 25–30 years | Very low, wash annually | Low-maintenance exterior; matches composite decking |
| Wrought iron / steel (3/4" sq) | $10–$25 | 30–50 years with paint | Touch up paint every 5–10 years | Traditional look; very strong |
| Aluminum (3/4" sq) | $8–$18 | 30+ years | Very low, powder coat is durable | Low maintenance; won't rust |
| Cable (1/8"–3/16" stainless) | $15–$40 per run | 30+ years | Low, occasional tensioning | Modern/contemporary; unobstructed views |
| Glass panels | $50–$150 per panel | 20+ years | Low, clean regularly | Premium decks; unobstructed views |
For deck framing and material estimates, see our deck calculator and deck materials guide.