How tall does a deck railing have to be? For a residential deck, the 2015 International Residential Code (IRC) sets 36 inches as the base guard height. Your adopted local edition decides what applies, so check these numbers before you build.
Under the 2015 IRC, a deck guard is required where an open edge drops more than 30 inches, and it must be at least 36 inches high. Openings must not pass a 4-inch sphere. Stair guards must be at least 34 inches. The City of Alameda reports that California requires 42 inches. Your local code and building department decide.
Which Code Applies to Your Deck?
A residential deck falls under the IRC, and a commercial building falls under the International Building Code (IBC). Both are model codes. A state or city adopts one edition, often with amendments, and that adopted text is the law where you build.
The two codes give different heights. The IRC sets 36 inches for residential walking surfaces, while the IBC default is 42 inches. Use the IRC rules for a single-family deck, and use IBC figures only for commercial work.
Once you know your height and baluster width, the railing calculator can run the gap math for you. The rules below still come first, because the calculator does not replace the code text.
When Does a Deck Need a Guard?
A guard is required where an open-sided walking surface sits more than 30 inches above the floor or grade below. Under the 2015 IRC R312.1.1, that trigger covers any open-sided walking surface, including stairs, ramps and landings. A drop of 30 inches or less does not trigger this rule.
The drawing shows both numbers on one deck edge. The 30 inch line is the trigger, and the 36 inch line is the guard height once the trigger applies. It is drawn to scale for these two heights only.
How Tall Must the Guard Be?
For a residential walking surface, the 2015 IRC R312.1.2 requires a guard at least 36 inches high, measured vertically above the adjacent walking surface. The table lists the other heights in the two sources. Each row names its source and edition.
| Rule | Applies to | Minimum height | Source and edition |
|---|---|---|---|
| Base guard height | Residential walking surfaces | 36 in | 2015 IRC R312.1.2 |
| Stair open-side guard | Open sides of stairs | 34 in | 2015 IRC R312.1.2, exception 1 |
| Default guard height | Commercial work under the IBC | 42 in | 2015 IBC 1015.3 |
| R-3 occupancy exception | R-3 occupancies only | 36 in | 2015 IBC 1015.3, exception 1 |
| California guard height | California residential code | 42 in | City of Alameda handout citing CRC R312, edition year not stated |
The 2021 IRC text could not be read for this article, so the 2021 edition is not confirmed here. The figures above are 2015 text. Check the edition your jurisdiction adopted before you order materials.
California’s figure is different. The City of Alameda guardrail handout says required guards at open-sided walking surfaces must be 42 inches high, and it cites the California Residential Code, section R312. That is a state rule, not the IRC number. The handout is a city page, not the state code text, and it gives no edition year.
The railing calculator’s FAQ says that some states, including California, require 42 inches. That claim is a tool statement. Only the Alameda handout supports the California figure in this article.
Stair Guards Follow Their Own Height
Stair guards have a lower minimum than the base residential rule. Under the 2015 IRC R312.1.2, guards on the open sides of stairs must be at least 34 inches high. Use the 34 inch figure only on the stair edge, and keep 36 inches for the deck edges.
The stair qualifier also changes the opening rule, which the next section covers. The railing calculator does not model the 34 inch stair exception, so a stair project needs a manual check against the code text.
How Big Can the Gaps Between Balusters Be?
Openings from the walking surface up to the required guard height must not pass a 4-inch sphere. Under the 2015 IRC R312.1.3, a sphere is a ball 4 inches across, and a gap that lets it through fails.
Stair guards get a different limit. Their openings must not pass a 4-3/8 inch sphere, which is slightly larger than 4 inches. The triangle opening at a stair must not pass a 6-inch sphere.
Worked example (our arithmetic on the rule, not a tool figure): a 3.5-inch baluster gap passes, because a 4-inch sphere cannot get through it. A 4-inch gap fails, because a 4-inch sphere passes through it.
The 4-inch test applies to openings from the walking surface up to the required guard height. The 2015 wording does not extend it to every gap on the railing. The railing calculator’s FAQ says the sphere cannot pass through any opening, so this article follows the source wording instead.
What the Railing Calculator Checks and Misses
The railing calculator takes total railing length, post spacing, railing height, baluster width and a target gap as inputs. Its three preset buttons fill those inputs with a 20 ft deck with 6 ft posts and 1.5 in balusters, a 30 ft deck with 8 ft posts and 0.75 in iron, or a 12 ft porch with 4 ft posts and 1.5 in balusters. These presets are tool settings, not code minimums.
Until you enter values, every result line shows a dash. Once you do, the IRC spacing check tests the 4-inch sphere rule. The tool does not model the 34 inch stair height, the 4-3/8 inch stair sphere, or the 42 inch IBC case, so stair and commercial projects need the rules above applied by hand.
Use the calculator for the arithmetic, and use the code text in this article to judge whether a result is acceptable. The tool’s disclaimer also tells you to confirm requirements with your local building department.
Why Local Code and the Edition Decide
Every number in this article comes from 2015 model code text or the City of Alameda handout. Your city, county or state decides what you must build, and its adopted edition may differ from both sources.
Before you build, work through this checklist with your building department and your engineer:
- Edition. Confirm the IRC or IBC edition your jurisdiction adopted, and whether it carries amendments.
- Stairs. Ask whether the stair height and stair opening limits apply to your stair.
- State rules. Check for a state amendment, such as the California figure of 42 inches.
- Engineering. Have your engineer review any unusual or load-bearing railing design.
Enter your railing length, post spacing, height and baluster width in the GeniesMag railing tool to see the sphere check. Confirm the code numbers with your building department.
FAQs About Deck Railing Height Code
Does every deck need a railing?
No. Under the 2015 IRC, a guard is required only where an open-sided walking surface sits more than 30 inches above the floor or grade below. Check your local code for lower decks.
Is 36 inches the railing height for every deck?
Not everywhere. The 2015 IRC sets 36 inches for residential decks. The City of Alameda cites 42 inches for California, and the 2015 IBC defaults to 42 inches for commercial work.
How high does a stair railing need to be?
Under the 2015 IRC, guards on the open sides of stairs must be at least 34 inches high. Use 36 inches for deck edges that are not stairs.
How big can baluster gaps be on a deck?
Under the 2015 IRC, a 4-inch sphere must not pass through openings from the walking surface up to the guard height. A 3.5-inch gap passes, and a 4-inch gap fails.
Do stair railings get a different gap limit?
Yes. Stair guard openings must not pass a 4-3/8 inch sphere, and the triangle opening at a stair must not pass a 6-inch sphere, both under the 2015 IRC.
Does the 2021 IRC keep these numbers?
This article uses 2015 IRC text only. The 2021 IRC text could not be read, so do not assume the numbers carry over. Ask your building department which edition applies.
Which code applies to a single-family deck?
The IRC applies to residential decks, so start with its guard rules. Commercial buildings fall under the IBC. Your adopted edition and local amendments decide the final numbers.
Sources and Further Reading
References Used in This Article
- Simpson Strong-Tie, “Deck Inspection for New and Existing Construction: Code References, 2015 Editions” (2018 handout hosted by City of Portage, Michigan), 2015 IRC Section R312 and 2015 IBC Section 1015.3 text, accessed 2026-11-18.
- City of Alameda, Planning, Building and Transportation, “Guardrails & Handrail Requirements”, accessed 2026-11-18.
This article covers 2015 model code text and one California city handout. It does not cover the 2021 code text, so check your adopted edition. Reviewed for accuracy by Prof. Dr. Khalil Mudassar, PhD. Last updated 2026-11-18.

Shakeel Muzaffar is the Founder and Editor-in-Chief, with over 15 years of experience in digital publishing and online tool development. He oversees editorial quality and formula verification to ensure accurate, practical, and easy-to-use calculators.