Deck Railing Height and Baluster Spacing Code
A deck guard is a safety system, not trim. Height, opening size and the handrail all have separate limits, and the limits change where the guard follows a stair.
Quick answer
IRC 2021 requires a guard at least 36" high where a deck surface is more than 30" above grade, measured within 36 inches of the open edge (R312.1.1, R312.1.2). The open side of a stair flight may use a 34" minimum under the R312.1.2 exception. Openings in a level guard must reject a 4" sphere (R312.1.3). On an open stair side the sphere is 4 3/8", and the triangular opening at the bottom of a stair guard is limited by a 6" sphere.
Open the baluster spacing calculatorWhat height does a deck guard need to be?
Measure from the finished deck surface to the top of the guard. The IRC 2021 minimum is 36"; the open side of a stair flight may use 34" under the exception to that section. Build the guard height into the post layout before you cut anything: a guard that measures short after the decking is installed has to be rebuilt, not shimmed.
Some commercial projects and local amendments ask for more. Check the locally adopted code before ordering rail stock; the model code minimum is the floor, not the ceiling.
Baluster spacing that passes the sphere rule
The sphere test uses a round ball that must not pass through any opening. For a level guard that ball is 4", so the clear space between balusters has to stay smaller than that after assembly.
Work from the inside faces of the posts, subtract the width each baluster occupies, then divide the remainder into equal bays. The baluster spacing calculator does that division and returns tape marks measured from the first post, so the marks do not accumulate error across the rail.
- Measure inside face to inside face, not post center to post center.
- Use the actual dressed baluster width; a nominal 2x2 is 1 1/2 wide when dry.
- Verify the clear opening with the sphere at the tightest point, including any hardware.
Where the rules change on a stair
On the open side of a stair, the guard opening limit becomes 4 3/8", because the measurement is taken on the slope. The triangular space formed by the stair tread, the riser and the bottom rail is limited by a 6" sphere.
Stair guards also carry a handrail at a different height from the guard itself. Plan the rail line off the stair nosing, then project the baluster positions onto the sloped rail before cutting.
What the calculator needs from you
Enter the clear rail span, the actual baluster width and whether the run is level or pitched. The calculator returns the baluster count, the clear gap and the mark positions; check the result against the sphere limit for that condition rather than against a generic spacing rule.
How to lay it out
- Measure the deck height. Measure from grade to the finished deck surface and confirm whether a guard is required at that height.
- Set the guard height. Lay out posts so the finished guard reaches at least 36" above the deck surface.
- Choose the baluster width. Measure a dressed baluster and use that actual width in the layout instead of the nominal size.
- Lay out equal openings. Divide the clear span into equal bays and keep every clear opening smaller than the sphere limit for that location.
- Check the installed guard. Test the finished openings and handrail height, then confirm the locally adopted code edition.
Frequently asked questions
At what deck height is a guard required?
The IRC 2021 guard threshold is a walking surface more than 30" above grade, measured within 36 inches horizontally of the open edge (R312.1.1). Local amendments can be stricter.
How tall should a deck guard be?
The IRC 2021 minimum guard height is 36", measured from the finished deck surface to the top of the guard (R312.1.2). The open side of a stair flight may use 34" under the exception to that section.
How far apart can deck balusters be?
Space them so the clear opening rejects a 4" sphere on a level guard (R312.1.3). The stair-side limit is 4 3/8" and the bottom triangle uses a 6" sphere.
Do deck stairs need a handrail or a guard?
An open stair side needs a guard, and stairs need a graspable handrail between 34" and 38" above the nosing line. A guard and a handrail are separate requirements and can be combined in one assembly.
Can I use a 42-inch guard?
Yes, where the adopted code or project requires it. A taller guard is not a code violation; a guard shorter than the minimum is. Confirm the requirement before cutting posts.
Calculators for this guide
Updated