Deck railing height code

Updated 2026-09-04    8 min read

Pencil sketch of a deck guard rail with balusters and measuring ticks
A guard with balusters, height measured from the walking surface.

A guard is not a handrail

Most confused searches are really two questions. A guard is the barrier along an open edge that stops you falling off; it has a minimum height and an infill that stops a small child passing through. A handrail is the graspable rail alongside a stair that your hand runs along; it has its own height range, its own graspable-shape requirement, and it has to return to a wall or post at the ends.

A stair on an open deck usually needs both: a guard along the open side, and a handrail at the right height for the hand. They are different heights, and the guard's top rail does not automatically satisfy the handrail rule — the shape has to be graspable too, which a flat 2× cap is not.

Pencil sketch of a rail post bolted through the rim joist
The post bolted through the rim joist — the connection inspectors test, not the height.

When a guard is required at all

Guards are triggered by the drop from the walking surface to the grade or floor below. The 2021 IRC sets that at more than 30 inches, measured vertically, at any point within 36 inches horizontally of the open edge (§ R312.1.1). Below it no guard is required; above it, one is. It decides whether the whole guard exists, and it is the number people most often assume from another deck.

Watch two traps. Grade is rarely flat, so a deck can be under the trigger at one corner and over it at another; the guard follows the drop, not the average. And a deck built low and later re-graded around can cross the trigger without anyone touching the deck.

Height, and where it is measured from

The 2021 IRC asks for not less than 36 inches on an open-sided walking surface, and not less than 34 inches on the open side of a stair, measured from the line connecting the nosings (§ R312.1.2). Height is measured from the walking surface to the top of the rail — the top of the decking, not the top of the joist and not the top of a future tile. Build to the joist and you are short by the thickness of a board.

Build to the minimum with no margin and a slightly proud cap rail or a decking upgrade later can put you under it. Framing a little tall costs nothing and takes the question off the table.

Local amendments to guard height are common — some jurisdictions require more than the model code, and a stair guard can differ from a level-surface guard. Read your adopted edition, not a number from another state's blog post.

The infill and the sphere test

The infill is tested with a sphere: no opening between the walking surface and the required guard height may pass a 4-inch sphere(§ R312.1.3), with two exceptions — 4⅜ inches on the open side of a stair, and 6 inches for the triangle formed by riser, tread and bottom rail. The inspector carries the ball and tries it at the tightest and the loosest points, and an installer who spaced balusters "by eye off a scrap" usually has one bay that fails.

Three places people miss. The gap between the bottom rail and the deck surface counts. The stair triangle has its own, looser limit and is the one people apply everywhere by mistake. And horizontal infill — cable, or horizontal boards — is a ladder for a toddler; it is restricted or prohibited in some jurisdictions, and cable needs tensioning and intermediate supports to keep its spacing under load rather than only on install day.

What actually fails: the post connection

A guard has to resist a substantial load applied at the top rail, in any direction. That load is not carried by the rail or the balusters — it is carried by the post and by how the post is attached to the frame.

The classic failure is a 4×4 notched around the rim joist and through-bolted. The notch removes most of the post's section exactly where the bending moment is highest, and it snaps. The fixes are well known: an unnotched post bolted to the inside face of the rim with blocking behind it, an evaluated hardware connector designed for guard posts, or a post that runs continuously past the frame.

Whatever you use, the connection needs blocking to stop the rim joist rolling. A post bolted to a rim with nothing behind it just rotates the rim instead of breaking.

Code requirement

Guard load, height and opening limits are in IRC 2021 R312.1; stair handrails in IRC 2021 R311.7. Your jurisdiction may amend the model code or adopt a different edition. Confirm with your building department before you cut.

Checking yours

Measure from the decking at four points along each run — decks are not perfectly flat and the low spot is the one that fails. Try a ball through every bay, including the bottom gap and the stair triangle. Then push hard on the top rail at the midpoint between posts: if the guard moves at the post base, that is the failure you have, whatever the tape says.

Getting the stair geometry right first makes the handrail easy — that is what the stair calculator is for, and the permit guide covers what the drawing has to show.

Sources

Next on the pile