Deck Railing Code

When a deck needs a railing, how tall it has to be, how far apart the balusters can go and what changes on the stairs, from the 2024 International Residential Code (IRC).

The short answer: a deck needs a guard where it is more than 30" above the ground. The guard must be at least 36" tall, and no opening in it may let a 4" ball through. Along the stairs the ball is 4 3/8" and the height is 34" above the nosings; in the triangle under the bottom rail, the ball is 6".

The numbers inspectors check

ItemModel codeIRC section
When a guard is requiredMore than 30" above the floor or ground at any point within 36" of the edgeR321.1.12021: R312.1.1
Guard height on a deck36" minimum from the deck boardsR321.1.22021: R312.1.2
Guard height on stairs34" minimum from the line of the nosingsR321.1.22021: R312.1.2
Openings on a deckA 4" ball must not passR321.1.32021: R312.1.3
Openings along stairsA 4 3/8" ball must not passR321.1.3, exception 22021: R312.1.3
Triangle under the bottom rail on stairsA 6" ball must not passR321.1.3, exception 12021: R312.1.3

Your city or county adopts the code with its own changes, and some still use an older edition. The numbers above have not changed between the 2021 and 2024 editions; only the section numbers moved.

When a deck needs a railing

The trigger is height, not size. A guard is required on any open side of a deck, porch, balcony or landing that is more than 30" above the floor or ground below, at any point within 36" of the edge. The 36" part matters on a sloping yard: measure the drop 3 feet out from the edge, not right next to the deck.

Insect screening does not count as a guard. Below 30" the code does not ask for one, but a railing still makes sense around a hot tub, a step-down or a deck that small children use.

How tall the railing must be

Baluster spacing: the 4" rule

The three ball sizes in the railing code A deck guard and the guard down the side of its stairs. Between the deck balusters a 4 inch ball must not pass. Between the stair balusters the limit is a 4 3/8 inch ball, measured level. In the triangle under the bottom rail, formed by the riser and the tread, the limit is a 6 inch ball. The deck guard is at least 36 inches tall and the stair guard at least 34 inches above the nosings. Deck: 4" ball must not pass Guard at least 36" tall Stair: 4 3/8" ball, measured level Guard at least 34" above the nosings Triangle under the bottom rail: 6" ball Nosing line
Drawn to scale: 2x2 balusters on the deck, a stair at 7 1/2" rise and 10 1/2" run. The circles are the balls an inspector uses.

The code does not give a spacing number. It gives a test: no opening in the guard may let a 4" ball pass, anywhere from the deck boards up to the required height. That covers the gaps between balusters, the gap between the last baluster and the post, and the space under the bottom rail.

Space your balusters

Stair railings

Two things change on the open side of a stair.

The ball is 4 3/8"

The extra 3/8" lets a stair use two balusters per tread. Because balusters stand plumb, the gap is measured level, not along the slope of the rail. With 2x2 balusters, two per tread work on treads with a run under 11 3/4". With 3/4" metal balusters, two per tread only work on runs under 10 1/4", so most deck stairs need three.

The triangle under the bottom rail: 6"

Where a bottom rail runs above the treads, the riser, the tread and the rail form a triangle. That opening may be larger, but it must still stop a 6" ball. With the rail right on the line of the nosings, a 7 1/2" × 10 1/2" stair leaves room for a ball about 5 1/8" across, so it passes. Raise the rail and the opening grows: on that stair, the underside of the rail can sit no more than about 1 5/16" above the nosings. The calculator checks it for your stair.

How strong a guard must be

The IRC load table (Table R301.5) asks two things of a guard:

Posts carry that load into the deck framing, and the code gives no single detail for how. The American Wood Council's deck guide, DCA 6, shows tested post connections with hardware that ties the post to the joists; a 4x4 bolted to the rim alone often loosens over time. Railing kits sold at Home Depot and Lowe's come with their own post spacing and mounting instructions, and following them is part of meeting the code.

Mistakes that fail inspection

Questions people ask

How high does a deck railing have to be?

At least 36" under the International Residential Code, measured straight up from the deck boards. On the open side of the stairs it is at least 34", measured from the line of the tread nosings. Commercial buildings and some cities ask for 42", so check locally.

Do I need a railing if my deck is under 30 inches?

The code requires one only where the deck is more than 30" above the ground at any point within 36" of its edge. Measure where the yard slopes away: a deck that starts low can be over 30" a few feet out. Below that, a railing is optional, but many people still add one.

What is the 4-inch rule for balusters?

No opening in a required guard may let a ball 4" in diameter pass through, from the deck boards up to the required height. Inspectors check it with a 4" ball or a gauge. It is sized to keep a small child's head from getting through.

Can balusters be exactly 4 inches apart?

Aim lower. A 4" ball must not pass, and wood moves: a gap that measures 4" at install can open up as the balusters dry and bow. Most builders space them about 3 1/2" apart.

Are horizontal railings allowed?

The model code does not ban horizontal rails or cable, as long as every opening stops a 4" ball. Some cities do ban them because children can climb them like a ladder, so ask your building department first.

Before you build: most decks attached to a house need a permit, and cities amend the IRC. Bring your layout to the building department and follow the railing maker's instructions; they count as part of the code.

Sources

Was this guide helpful?

Help us improve this guide

Was it helpful?

Only if you want a reply.