Railing Linear Feet Calculator
How much railing do you actually need? DeckMath sums perimeter minus house-attached sides minus gates, plus angled stair handrail (hypotenuse), with material-specific post spacing (4-6′ o.c.). 5 tiers from PT cap ($24/lf · DIY) to tempered glass ($105/lf · luxury). Auto IRC R312 guard-height flag + R311.7.8 stair-handrail check.
Inputs
Deck shape
Main rectangle
⚠ IRC R312 — 36″ guardrail required.
Stairs
Results
IRC R312 guardrail required (36″) · IRC R311 stair handrail required · DIY tier 1
Perimeter diagram
Guardrail required — 36″ off grade ≥ 30″
IRC R312.1.1 + R312.1.2IRC R312.1.2 mandates a 36″ minimum guardrail on the open sides of decks more than 30″ above grade. 40 LF of guardrail in the BoM.
Stair handrail required — 5 risers ≥ 4
IRC R311.7.8.1 + R311.7.8.4IRC R311.7.8.1 requires a handrail on at least one side of stairs with 4+ risers. 5.48′ hypotenuse per side · one side × 1 stair = 5.48 LF of angled handrail. Returns at top + bottom (R311.7.8.4) included as bracket-kit line item.
Post spacing — max 6′ o.c. (10 posts total)
IRC R312.1.4 + manufacturer spec6′ max post spacing meets IRC R312.1.4 + manufacturer spec. Composite sleeves slip over a 4×4 PT structural post.
4″ sphere rule — opening limit verified
IRC R312.1.3.1 + R312.1.3.3IRC R312.1.3.1 requires that a 4″ sphere cannot pass through any guardrail opening. Baluster centers at ≤4″ (use the Baluster Spacing Calculator to size individual baluster placement once total LF is set). Stair triangle (R312.1.3.3) limited to 4-3/8″ — handrail brackets account for this.
Material tier 1 — DIY-friendly
Manufacturer install specBest value mid-market. Color-matched cap, 25-yr warranty, no repaint. DIY-friendly w/ pre-cut kits.
Cost breakdown
- Materials
- $2,953 – $3,210
- Labor
- $899 – $1,099
- Soft costs
- $0 – $0
- Subtotal
- $3,852 – $4,308
- Contingency (8%)
- $345
- Project total
- $3,852 – $4,653
- Cost per linear foot (45.48 lf)
- $85 – $102
2026-Q1 pricing. Ranges reflect contractor vs DIY purchase, regional supplier variance, and the 7% material waste typical of composite cap rail w/ aluminum balusters (trex signature / tt classic). Permit fees are average residential — your local AHJ may charge more. Always verify code with your local inspector before ordering.
How to use
Three steps. Permit-ready output.
- 01
Pick the deck shape
Rectangle (most common — 2L+2W perimeter), L-shape (main rect + leg, minus shared edge), U-shape (main rect + two legs), or Custom LF for unusual layouts. For Custom, enter the total OPEN perimeter directly (already net of attached sides). L and U-shape inputs accept the secondary leg's length × width independently.
- 02
Set deck dimensions + attached sides
Length × width in feet. Attached-sides count: 0 = freestanding (full perimeter needs rail), 1 = one side against house (subtract length), 2 = corner-nested (subtract length + width). House-attached sides don't need guardrail per IRC — only the open sides do.
- 03
Enter stair geometry
Stair count (0-3 landings), total rise (deck height to grade in inches), and total run (stringer horizontal in inches). DeckMath computes the stringer hypotenuse via √(rise² + run²) and adds that length per stair side. Toggle 'handrail both sides' for wider stairs (>44″) per IRC R311.7.8.
- 04
Add gates if any
Each gate subtracts 3 feet from the guardrail LF (standard residential gate width). Gates are separately costed line items with self-closing + child-safe latch hardware (pool-code compliant). 0-4 gates supported.
- 05
Pick material tier + state
PT cap ($24/lf, DIY tier 1), composite cap ($42/lf, DIY tier 1 — best value), cable ($58/lf, DIY tier 2 — premium open view), glass ($105/lf, pro-only tier 3 — luxury), aluminum ($48/lf, DIY tier 1 — fastest install). State selection adjusts labor cost via regional multipliers (12 US regions).
How we calculate
The math, fully transparent.
The Railing Linear Feet Calculator sizes the total guardrail + handrail you need for a deck — perimeter minus house-attached sides minus gates, plus the angled stair handrail run, with code-compliant post layout. Pick deck shape (rectangle, L-shape, U-shape, or custom LF), attached-side count, stair geometry, and one of five material tiers: pressure-treated cap rail ($24/lf · DIY), composite cap ($42/lf · best value), cable ($58/lf · open view), glass ($105/lf · luxury), or aluminum picket ($48/lf · low maintenance). DeckMath returns ordering LF including waste, post count at material-specific max spacing (4-6′ o.c. per IRC R312 + manufacturer instructions), the IRC-required guard height (36″ or 42″), and a BoM with installed-cost ranges accounting for regional labor (12 US regions) and permit fees. Distinct from the Baluster Spacing Calculator (D.1, MVP) which fills a known railing length with code-compliant balusters — this calc tells you HOW MUCH RAIL you need before you start measuring balusters.
IRC references
- IRC 2021 R312.1.1 — Guards required on open sides of decks > 30″ above grade
- IRC 2021 R312.1.2 — Guard height 36″ minimum (residential); 42″ above 6′ in some jurisdictions
- IRC 2021 R312.1.3.1 — 4″ sphere rule (no opening allows passage of 4″ sphere through guardrail)
- IRC 2021 R312.1.3.3 — Stair triangle 4-3/8″ opening limit
- IRC 2021 R311.7.8.1 — Handrail required on at least one side of stairs with 4+ risers
- IRC 2021 R311.7.8.3 — Continuous handrail along entire stair flight; returns at top/bottom
- IRC 2021 R311.7.8.5 — Handrail clearance 1.5″ minimum from wall
- IRC 2021 R301.5 — Guard live load 50 lb single point applied any direction
Railing pricing 2026-Q1: PT cap $24/lf, composite cap $42/lf (Trex Signature / TimberTech Classic), aluminum picket $48/lf (Westbury / Fortress), cable rail $58/lf (Feeney / Atlantis), tempered glass $105/lf (10mm panel). Labor $12-45/lf by material. Waste 4-10% by material. Post spacing per IRC R312.1.4 + manufacturer.
Sum of all four sides. 16×12 rectangle = 56 LF perimeter. With 1 house-attached side (length = 16′), open perimeter = 40 LF.
Main rectangle plus leg rectangle, minus twice the shared edge where the leg attaches to the main. For a 16×12 main + 8×6 leg (shared edge = 6′): 56 + 28 − 12 = 72 LF.
Stringer length per stair. For a 36″ rise + 55″ run stair: √(36² + 55²) / 12 = √(1296 + 3025) / 12 = √4321 / 12 ≈ 5.48 LF per side. Two-side stairs (>44″ wide) double this.
Waste varies by material: PT cap 10% (miter cuts + end loss), composite 7%, cable 4% (cut-to-length kits), glass 5%, aluminum 6%. For 40 LF composite cap: 40 × 1.07 = 42.8 LF ordered.
Cable rail max spacing is 4′ (tension load); composite/PT/aluminum/glass all permit up to 6′. For 40 LF of cable rail in a rectangle: 4 corners + ceil(40/4) − 4 + 1 = 11 posts (guard) + 2 stair posts = 13 total.
Residential decks above 30″ must have a 36″ minimum guard. Some jurisdictions require 42″ above ~72″ (commercial threshold). DeckMath flags 42″ when deck height > 72″ as a code-safety hint.
Save your plan
Don’t lose this estimate.
Your inputs are preserved in the URL — email it to yourself or copy the link so you can compare with contractor bids later. No account needed.
Frequently asked
Questions, answered.
Embed this calculator
One line. Any site. Free.
Drop the snippet into your contractor site, blog, or marketing page. Theme matches the parent site automatically.
<!-- Drop into any HTML, WordPress, Webflow, or contractor site -->
<script src="https://embed.deckmath.com/v1.js"
data-deckmath-calc="railing-linear-feet-calculator"
data-theme="auto"
async></script>Related