DeckMath
All animations
5-phase build · IRC R312 + R311.7.8

How a deck railing goes together

The fourth animation in the build narrative (Foundation → Framing → Decking → Railing). Watch posts rise, top rail connect, and infill fill the gap — toggle between composite, cable, and wood systems to see how the geometry shifts.

Loading 3D scene…
Phase 0 / 5 · Base
Finished deck with rim joists exposed — no railing yet. Posts will mount to the rim, not the deck surface, per IRC R507.9.1.3.
Railing material
Phase 0 / 5Base
BaseAnchPostTop InfiSett
What this animation shows
  • Post-anchor mounting through rim joist (not surface)
  • IRC R312.1.2 (36″ guard) + R312.1.3 (4″ sphere)
  • Composite vs cable vs wood geometry differences
  • Graspable handrail per R311.7.8
What this animation doesn't cover
  • Glass panel rail systems (tempered + structural)
  • Stair railing geometry (covered in Stair Construction)
  • Lighting integration (post caps, under-rail strips)
  • Decorative post sleeves + post caps

Spec your railing system

Railing FAQ

How do you build a deck railing step-by-step?

1) Install post-base anchors through the rim joist with 2 × 1/2″ bolts per anchor (4 at corners). 2) Set newel posts in anchors, plumb in 2 axes, secure with through-bolts. 3) Run top rail post-to-post at 36″ above deck. 4) Install infill — balusters at 3-3/4″ spacing (composite/wood) or horizontal cables at 3″ (cable systems). 5) Mount graspable handrail. Most decks need 6-12 newel posts spaced at 6 ft on-center.

Why do railing posts attach to the rim joist instead of the deck surface?

IRC R507.9.1.3 requires post-to-deck connections to resist 200 lb of lateral force at the top of the post — far more than a top-down surface attachment can carry. The rim joist (with through-bolts) gives the post mechanical pull-back; surface fasteners alone strip out under loaded conditions. Post-base anchors that bolt through the rim are the code-default approach.

What is the minimum height for a deck railing?

36 inches measured from the deck surface to the top of the rail for residential decks per IRC R312.1.2. The 36″ rule applies whenever the deck is more than 30″ above grade at any point. Multi-family and commercial decks step to 42″. Some jurisdictions allow 32″ for pool decks (the surrounding pool fence is the primary safety barrier in that case) — verify with your AHJ.

What is the 4-inch sphere rule for deck balusters?

Per IRC R312.1.3, no opening in the guardrail system can be large enough to pass a 4-inch-diameter sphere. The rule prevents children from getting limbs trapped between balusters. Most builders space balusters at 3-3/4″ for safety margin. Cable rail systems use the same rule at 3″ spacing between cables (cables can deflect under load, so the design assumes a 1″ buffer).

Do deck stairs need handrails?

Yes — IRC R311.7.8 requires a graspable handrail on at least one side of any flight with 4 or more risers. The handrail must be continuous from top to bottom (no breaks at landings), 34-38″ above tread nosing, and shaped so a hand can grasp it. A 2×4 lying flat is NOT graspable; you need a 1-1/4 to 2″ diameter circular profile or an equivalent ergonomic shape.

Can I install cable rail on wood posts?

Yes, but with caveats. Cable tension can exceed 250 lb per cable run; multiplied across a typical 6-cable infill, that's 1,500 lb of inward pull on each post. Standard 4×4 PT posts deflect under this load + ratchet over time. Most cable-rail manufacturers require 4×6 wood posts minimum, or steel I-beam posts wrapped in wood for aesthetics. Always follow the cable manufacturer's post-sizing chart.

Railing is where deck inspections fail most often

Inspectors check height with a 36″ stick, baluster spacing with a 4″ test sphere, post connection with a 200 lb lateral push test (or by examining bolt patterns). Eyeballed-spaced balusters fail constantly — use a spacing template. Top-down surface-attached posts fail constantly — bolt through the rim. The fixes are cheap if done at framing time; expensive once decking is over the rim.

Embed this animation on your site

Free to embed on contractor sites, blogs, WordPress, Webflow — anywhere HTML works. Theme matches the parent page automatically.

iframe embed
<iframe src="https://deckmath.com/embed/animation/railing-construction?theme=auto"
        width="100%" height="560" frameborder="0" loading="lazy"
        title="DeckMath animation" allow="clipboard-write"></iframe>

Each embed shows a small “DeckMath” logo + link in the corner. Backlinks help us keep this free.