Deck Railing Code

Your Guide to Safe, Code-Compliant Deck Railing

If you’re building or updating a deck, the railing isn’t just a finishing touch, it’s a safety system that has to meet code. Here, we break down the rules in easy-to-understand terms, show how cable and glass rails satisfy those rules in different ways, and point you to deeper guidance for when you’re ready.

Why is Deck Railing Code so Important?

Code requirements can be wordy and difficult to sift through. We get it.

Especially if you’re a homeowner, you might wonder which codes actually apply to you, and whether you actually have to pay close attention. Though it might be a bit tedious to sift through, deck railing code is in place for a reason: it exists to keep people safe. After all, if you’ve invested in a deck railing system, you want to make sure that that system protects the people you care about for years to come.

Thankfully, a little research goes a long way. Here are the basics: 

Guard vs. Handrail: What's the Difference?

A guard is the barrier along the open edges of your deck and at stair landings. Its job is to prevent falls.

A handrail is the thing you hold while using stairs. It helps with balance and must be shaped so a hand can comfortably wrap around it.

Many projects need both: a guard at the edges and a handrail along the stairs. However, especially in single-family homes, the top of the guard can also count as the handrail, saving the need to install them separately. 

Guard with a separate handrail

Guard that doubles as a handrail

When Do You Need a Guard?

Any time there’s a significant drop at the edge of the deck, you’ll need a guard. Many places use a height threshold of 30 inches above the ground within a set distance of the edge, but the exact number depends on your local code. The bottom line: if your deck isn’t right at ground level, plan on having a guard and confirm the specifics with your local building department.

Heights, Openings, and Strength: The Basics

Guard height: For most homes, the required guard height is 36 inches. In commercial or multifamily settings, it’s often 42 inches. Your local rules take precedence, so always check.

Openings: On level deck guards, gaps must be small enough that a 4-inch sphere can’t pass through. Stairs have a few special cases, such as the back of a step not allowing a 6-inch sphere to pass through, but the idea is simple: no big openings where a child could slip through.

Strength: Rails must resist both steady pressure and sudden pushes. Think of people leaning, kids pressing on infill, or a guest bumping the top rail. A compliant system is sturdy, doesn’t wobble, and stays that way over time because it’s properly attached to solid framing.

Viewrail's cable are set apart 3 1/8 inches on center so that a 4-inch sphere won't pass.

A 6-inch sphere won't fit through the triangular space create between the steps and angled railing.

Handrails on Stairs

Stairways bring a few extra rules. Once you have more than a few risers (often four or more), a handrail is typically required on at least one side.

The handrail must fall within a certain height range, usually 34-38 inches, and be graspable, not just decorative.

Stair guards also follow opening rules, but the measurements are taken along the sloped line of the stair, which is why stair rules can differ from level deck rules. Plan where the handrail starts and stops and how the guard continues across landings so everything feels continuous and secure.

Structure Matters: Posts, Framing, and Attachment

Even the best infill won’t pass inspection if it’s not supported correctly.

Post layout and stiffness: Your post spacing and the stiffness of your top rail affect how the whole system performs. This is especially important for cable railing, where controlling deflection (getting out of line from their original position) is key.

Blocking and backing: Expect to add blocking at the deck edge to transfer loads into the framing. Good blocking means a stiffer, more reliable railing.

Fasteners and corrosion: Use the right fasteners for your environment (stainless in coastal regions, for example) and be mindful of edge distances and dissimilar metal contact (e.g., steel and aluminum) which can cause corrosion.

Water management: Seal where nails or screws penetrate the deck, add flashing where needed, and avoid creating water traps when you tighten posts and hardware.

Pro tip: If you’re upgrading an older deck, have a qualified pro verify the framing can handle today’s guard loads before you change the railing.

Viewrail posts are typically spaced 4 feet apart for optimum stability.

Viewrail uses 2205 stainless steel on coasts for superior corrosion resistance.

Cable Railing: Keep Deflection in Check

Cable systems follow the same opening rule (that 4-inch sphere) as any other guard, but the way you comply is by controlling deflection — in other words, making sure the cables don’t spread apart under pressure. That means:

  • Proper tensioning at install and periodic checks over time.
  • A stiff top rail and sensible post spacing so the frame holds the line.
  • Thoughtful planning at corners and stairs so you maintain tension and consistent spacing throughout the run.

If you want the full nuts and bolts on cable railing code — how to space posts, what top-rail stiffness does, and how to keep openings within limits — head here:

Know the Code: Cable Railing

Glass Railing: Specify the Right Glass and Supports

Glass guards rely on safety glazing (glass) and correctly engineered hardware to satisfy height, opening, and strength rules. Depending on the system and occupancy, you may use tempered glass, laminated glass, or a combination. Some systems require a continuous top cap, while others use laminated glass that’s designed to act as part of the guard. Panel size limits, wind exposure, and attachment details all factor in.

For a deeper dive into glass types, top-rail requirements, panel sizing, and wind considerations, see:

Know the Code: Glass Railing

Regional and Special Situations

Coastal and High-Wind Areas

Expect stricter attachment requirements. For glass, you’ll also see specific panel and support requirements tied to wind exposure.

Snow and Ice

Plan for drainage and winter maintenance. Cable may need tension checks after harsh seasons; glass hardware should be inspected and kept clean.

Pools

Pool barriers are their own category. Many places require 48 inches minimum height, plus latch and clearance rules that go beyond typical deck code.

Multifamily and Commercial

These spaces often follow different rules than one- and two-family homes (such as taller guards) so don’t assume residential details carry over.

How to Plan and Permit Without Headaches

Start with a few simple steps:

  1. Measure your deck height above grade, the lengths of each run, and your stairs/landings. 
  2. Choose your infill (cable or glass), the post layout, and a top-rail profile that works with your deck structure. 
  3. Confirm your local code adoption and any amendments. If you’re in an HOA, check those rules too. 
  4. Document the basics in a drawing: spans, post locations, attachment details. Your inspector and installer will thank you.

 

Frequently Asked Questions

Need a Hand?

Viewrail systems are engineered to meet code when installed per instructions, and we’re glad to help. If you want someone to look at your plan, talk through code questions, or set up installation services, reach out. And if you already know your direction, dive into the details here:

Cable Railing Code & Safety

Know the Code: Glass Railing

Build it once, build it right, and enjoy the view.