Deck Railing and Guard Code Requirements
Most of what people believe about deck railing is roughly right and precisely wrong. The trigger is not a height off the ground, the sphere is not one size, the number everybody quotes for post spacing is not in the code at all, and the figure that decides whether the guard survives being leaned on sits in a different table that your state is allowed to rewrite. Here is each rule, the section it comes from, and the document that section was read in.
Height triggers the guard, and the measurement reaches three feet out
Nothing about the size of a deck requires a guard. One sentence decides it, and it is worth reading to the end rather than to the first number:
Guards shall be provided for those portions of open-sided walking surfaces, including floors, stairs, ramps and landings that are located more than 30 inches (762 mm) measured vertically to the floor or grade below at any point within 36 inches (914 mm) horizontally to the edge of the open side. Insect screening shall not be considered as a guard.
IRC R312.1.1, read from the Routt County, Colorado reproduction of the 2021 IRC Code and Commentary
Two measurements, not one. The vertical one is 30 in. The horizontal one is 36 in, and it is the reason the rule catches decks that look low.
Picture a deck on ground that falls away. At the rim the drop is 27 in and nobody thinks twice. Two and a half feet out, still inside the 36 in the section names, the ground has dropped another six inches. That deck is over 30 in at a point the code tells you to measure, and the owner who measured once at the rim has already bought the wrong railing.
The screening sentence closes the other loophole. A screened porch sitting 40 in up is an open-sided walking surface with mesh across it, and mesh is not a guard. So do the tape work first, at the low point within three feet of every open edge, and let the deck railing calculator check the trigger against your own numbers afterwards.
Thirty-six inches, measured from a surface that may not exist yet
Once a guard is required, the height is prescribed:
Required guards at open-sided walking surfaces, including stairs, porches, balconies or landings, shall be not less than 36 inches (914 mm) in height as measured vertically above the adjacent walking surface or the line connecting the nosings.
IRC R312.1.2, height
And the stair case is written out separately, with a range rather than a floor where the guard doubles as something to hold:
Guards on the open sides of stairs shall have a height of not less than 34 inches (864 mm) measured vertically from a line connecting the nosings. Where the top of the guard serves as a handrail on the open sides of stairs, the top of the guard shall be not less than 34 inches (864 mm) and not more than 38 inches (965 mm) as measured vertically from a line connecting the nosings.
IRC R312.1.2, exceptions 1 and 2
The words that cost money are “above the adjacent walking surface”. That is the top of the decking, not the top of the joists. A guard post cut to 36 in while the frame is still bare ends up 36 in less the board thickness once the decking is down, which is under the minimum by the full thickness of the board, and the fix at that stage is new posts.
The 42 in figure that circulates is not in this section. R312.1.2 says not less than 36 in, so building taller is permitted, and your building department is the place to confirm whether your jurisdiction has amended it.
Three sphere sizes, and only one of them is four inches
The opening rule is one sentence for the ordinary case:
Required guards shall not have openings from the walking surface to the required guard height that allow passage of a sphere 4 inches (102 mm) in diameter.
IRC R312.1.3, opening limitations
R312.1.3 then sets two more limits that almost never make it into a summary. On the open side of a stair the infill limit relaxes to 4 3/8 in. The triangular opening formed by the riser, the tread and the bottom rail of the guard is held to 6 in.
So one deck with a stair on it carries three different sphere sizes at once, and which applies depends on where you are standing. A page that answers four inches has answered a third of the question.
Note the phrase from the walking surface. The band being policed starts at the deck boards, so the gap under the bottom rail is inside it. That is also the gap people deliberately open up, because a bottom rail sitting on the decking traps leaves and holds water, and it passes a 4 in sphere long before anything between the balusters does.
Deck railing spacing, worked out for a 1 1/2 inch baluster
Baluster spacing is a packing problem with one more gap than there are balusters, because the gap at each post counts. Below is the smallest legal count for a range of clear spans, and the gap it leaves, for square stock measuring 1 1/2 in.
| Clear span between posts | Level guard, 4 in limit | Gap it leaves | Open side of a stair, 4 3/8 in limit | Gap it leaves |
|---|---|---|---|---|
| 36 in | 6 | 3 7/8 in | 6 | 3 7/8 in |
| 42 in | 7 | 3 15/16 in | 7 | 3 15/16 in |
| 48 in | 9 | 3 7/16 in | 8 | 4 in |
| 54 in | 10 | 3 9/16 in | 9 | 4 1/16 in |
| 60 in | 11 | 3 5/8 in | 10 | 4 1/16 in |
| 66 in | 12 | 3 11/16 in | 11 | 4 1/8 in |
| 72 in | 13 | 3 3/4 in | 12 | 4 1/8 in |
Up to a 42 in bay, the stair relaxation buys you nothing. At 36 in and at 42 in both limits need the same number of balusters, because the count is an integer and three eighths of an inch does not add up to a whole baluster yet. From 48 in upward it saves exactly one per bay, and never more than one across this range.
It runs the other way too. The stair column is at gaps of 4 to 4 1/8 in, legal on the open side of a stair and illegal six feet away on the level deck, so one spacing cannot be carried around the corner.
Two notes on using the table. Clear span is measured between post faces rather than centers, so a 6 ft bay with 3 1/2 in posts is a 68 1/2 in clear span at best. And a spacer block cut to the gap shown produces the layout the arithmetic describes; measuring each baluster off a tape does not.
The load is in a different table, and your state is allowed to rewrite it
R312 gives the geometry. What the guard has to survive is in a separate table.
Table R301.5 lists 200 lb for guards and handrails and 50 lb for guard in-fill components. Its footnotes define the 200 lb as a single concentrated load applied in any direction at any point along the top, and the 50 lb as a horizontally applied normal load on an area equal to 1 square foot, acting on balusters and panel fillers. That wording was read from the 2018 IRC table as printed in the 2018 Seattle Residential Code, where the table is tagged [W][S] and the deck row shows 40 in double parentheses beside 60, while the guard rows carry no such marking. Later editions may word the footnotes differently, so check the edition you are under.
That load concentrates at the connection between the guard post and the deck frame, which is why the example guard detail in DCA 6 marks its 4x4 guard post DO NOT NOTCH. The sphere rule is geometry you can check with a ball; the load is the part that decides whether the guard holds a person.
And Table R301.5 is a table states amend. Washington did, for the deck live load in the same table, and its own code council was asked what the amendment meant for the span tables printed alongside it:
The state amended the live load in Table R301.5 for decks and balconies from 40 pounds per square foot (psf) to 60 psf. The 2015 IRC Section 507 - Exterior Decks, includes joist and beam span tables, and a ledger connection table, which contain values for live load on decks and balconies based on 40 psf.
Washington State Building Code Council, State Building Code Interpretation No. 16-11, requested by the City of Seattle
The answer was that the amendment did not bring amended tables with it, so the interpretation published replacement ones and quantified what moved for Douglas fir and hem-fir lumber. Joist spans came down by an average of 11 percent and beam spans by 8 percent. Ledger bolt spacing tightened by an average of 38 percent and through-bolt spacing by 42 percent, so the ledger connection moved further than either span.
That is a deck live load rather than a guard load, and the two should not be confused. The point stands for both: a figure in Table R301.5 is a figure your jurisdiction can have changed, and the tables printed beside it do not change with it automatically.
Deck post spacing is two different questions with two different answers
Search for deck post spacing and the results mix two unrelated things: the posts that hold the guard up, and the posts that hold the deck up. Only one of them has a published table.
Guard posts: no code spacing exists
The IRC prescribes the load on a guard, not a spacing for its posts. The 6 ft maximum everybody repeats is marked on Figure 24 of the American Wood Council's DCA 6, an example guard detail with 4x4 posts at 6'-0" maximum spacing. That is not Section R312. On a wood guard built to that detail, treat 6 ft as the figure to check against; on a manufactured system, its own installation instructions govern.
Structural posts: the spacing is the beam span, and it caps the height
Under the deck, spacing is not a free choice at all. The distance between posts is the beam span, and DCA 6 Table 4 reads beam span and joist span together to cap how tall the post may be. Below, the rows for a deck carrying 14 ft joists, with the load on a center post worked out from DCA 6's own assumptions.
| Post spacing (beam span) | Tributary area per post | Load at 50 psf | 6x6 southern pine | 6x6 Douglas fir-larch | 6x6 SPF | 4x4 Douglas fir-larch |
|---|---|---|---|---|---|---|
| 6 ft | 63 sq ft | 3,150 lb | 14 ft | 14 ft | 14 ft | 2 ft |
| 8 ft | 84 sq ft | 4,200 lb | 14 ft | 14 ft | 11 ft | 2 ft |
| 10 ft | 105 sq ft | 5,250 lb | 14 ft | 13 ft | 8 ft | 2 ft |
| 12 ft | 126 sq ft | 6,300 lb | 13 ft | 12 ft | 5 ft | 2 ft |
| 14 ft | 147 sq ft | 7,350 lb | 11 ft | 10 ft | 2 ft | 2 ft |
| 16 ft | 168 sq ft | 8,400 lb | 10 ft | 9 ft | 2 ft | 2 ft |
| 18 ft | 189 sq ft | 9,450 lb | 9 ft | 8 ft | NP | 2 ft |
Read the load column first. Tripling the spacing from 6 ft to 18 ft triples the load each post carries, from 3,150 lb to 9,450 lb, and the price is six feet of allowable height in Douglas fir-larch, while in SPF the table stops permitting the post at all. Fewer holes to dig is why people widen the spacing, and that is what it costs.
Species moves the answer further than spacing does. At a 12 ft spacing the same 6x6 goes 13 ft in southern pine and 5 ft in SPF, and the grade stamp is what tells you which you bought. And the 4x4 column is 2 ft the whole way down. DCA 6 requires 6x6 or larger in its prescriptive text; the 4x4 heights sit in the Commentary, which makes a 4x4 an Alternative Method needing your building official's approval. The deck post calculator carries both tables in full.
How to build a deck railing, in the order the figures apply
The sequence matters because several of these numbers stop being adjustable once the step before is done.
- Measure the drop at the low point within 36 in of every open edge. That is what R312.1.1 asks for, and it decides whether any of the rest applies.
- Confirm the edition your jurisdiction has adopted, and whether Table R301.5 is amended. One phone call, and it is the only way to know the figures here are the figures you are building to.
- Decide the post positions before the frame is closed in. Guard posts carry a 200 lb load into the deck frame, so their attachment is a framing decision rather than a trim decision. A manufactured system sets the spacing at this step.
- Lay the decking, then measure the post height. The 36 in is from the walking surface, and cutting posts against the joists costs you the thickness of a board.
- Set the bottom rail so the gap under it stays inside the sphere limit, before the balusters go in, while the bay is still empty enough to change.
- Space the infill from a cut spacer block. Around a stair, switch to the stair layout rather than carrying the level one through, and check the triangle at the bottom rail against the 6 in sphere separately.
- Field-treat every cut end and notch. DCA 6 requires it, with an approved preservative such as copper naphthenate.
- Use corrosion-resistant hardware throughout. This is an exterior connection carrying a person.
What this guide does not decide
It does not detail the post-to-frame connection. The code gives a load, not a detail. DCA 6 gives details, manufactured systems give their own, and which applies depends on what you are building.
It does not know your edition or your amendments. The guard text was read from a 2021 IRC reproduction, the guard loads from a 2018 IRC table as printed in Seattle, and the load interpretation from a 2015 IRC adoption in one state, which is why every figure above names its document.
It does not carry the commercial figures. Where this page says 36 in it is reading the IRC, which covers one- and two-family dwellings, and nothing here applies a figure from any other code.
And it does not size the deck. Ledger attachment, lateral load connection, beam and joist spans, footings and frost depth all sit outside R312, and each has its own page here.
Run the numbers
- Deck Railing Calculator balusters, posts and the gap each layout leaves
- Deck Post Calculator DCA 6 Table 4 and the 4x4 Commentary table
- Deck Beam Calculator the span that sets your post spacing
- Deck Footing Calculator what each of those posts stands on
- Stair Construction Calculator risers, treads and the nosing line
- Deck Fastener Calculator screws, hangers and corrosion class
Frequently asked questions
- At what height does a deck need a railing?
- More than 30 in above the floor or grade below, measured at any point within 36 in horizontally of the open edge, under IRC R312.1.1. On ground that slopes away from the deck, measure at the lowest point inside that 36 in rather than at the rim. Insect screening does not count as a guard.
- How tall does a deck railing have to be?
- Not less than 36 in for a one- and two-family dwelling, under R312.1.2, measured from the walking surface. Guards on the open sides of stairs may be 34 in from the nosing line, and where the top of the guard serves as the stair handrail it must be between 34 and 38 in. The 42 in figure people quote does not appear in R312.1.2.
- How far apart can deck balusters be?
- Close enough that no opening passes a 4 in sphere, under R312.1.3. With 1 1/2 in stock that means 9 balusters across a 48 in clear bay, leaving a 3 7/16 in gap, or 13 across 72 in leaving 3 3/4 in. The limit relaxes to 4 3/8 in on the open side of a stair only.
- Is deck railing spacing really 4 inches everywhere?
- No, and this is the most common error. R312.1.3 sets 4 in on a level guard, 4 3/8 in on the open side of a stair, and 6 in for the triangular opening formed by the riser, tread and bottom rail. One deck with a stair has all three limits on it at once.
- Does the gap under the bottom rail count?
- Yes. The section limits openings from the walking surface up to the required guard height, so the space between the bottom rail and the deck boards is inside the band. A bottom rail lifted for drainage still has to keep that gap from passing a 4 in sphere.
- How far apart should deck railing posts be?
- The IRC does not set a spacing. Six feet comes from the example guard detail in AWC DCA 6, Figure 24, which marks 6'-0" maximum spacing; where you are fitting a manufactured system its own instructions govern. What the code does set is the 200 lb concentrated load in Table R301.5 that the guard has to carry.
- What are the deck post spacing requirements under the deck?
- For structural posts the spacing is the beam span, and DCA 6 Table 4 reads it together with the joist span to cap the post height. Carrying 14 ft joists in Douglas fir-larch, a 6x6 reaches 14 ft at a 6 ft spacing and 8 ft at an 18 ft spacing. DCA 6 requires 6x6 or larger; a 4x4 sits in its Commentary at about 2 ft.
- How do I build a deck railing that passes inspection?
- Check the 30 in trigger at the low point within 36 in of the edge, confirm your adopted edition, fix the post positions while the frame is open, lay the decking before cutting posts to 36 in, and space the infill from a spacer block cut to the calculated gap. Field-treat every cut end and use corrosion-resistant hardware.
- What does deck railing cost per linear foot?
- HomeAdvisor's deck building guide prices railings at $35 to $210 per linear foot and does not split that range by material. Last price check: 2026-09-13. HomeGuide's deck repair guide prices railing replacement at $20 to $250 per linear foot. Last price check: 2026-09-15.
Check these numbers yourself
- 2021 IRC Code and Commentary, Section R312 GuardsRoutt County, Colorado reproduction of the 2021 IRC Code and Commentary. Source of the verbatim R312.1.1, R312.1.2 with its two stair exceptions, and R312.1.3 with its 6 in and 4 3/8 in exceptions. Used because codes.iccsafe.org returns HTTP 403. Read 2026-09-07.
- AWC DCA 6, Prescriptive Residential Wood Deck Construction GuideAmerican Wood Council, based on the 2015 IRC, 04-18 printing, free PDF. Post requirements on page 10, Table 4 on page 12, Figure 24 guard detail on page 19, Appendix B tributary area on page B1 and Table C4A in Commentary C7. Source of the 6x6 minimum, the post height tables, the 6'-0" maximum guard post spacing in Figure 24, the stated 40 psf live and 10 psf dead and LJ/4 overhang assumptions, and the field treatment of cut ends. Read 2026-09-16.
- Washington State Building Code Interpretation No. 16-11Washington State Building Code Council, requested by the City of Seattle, on the 2015 IRC as adopted in Washington. Source of the Table R301.5 deck live load amendment from 40 to 60 psf and of the quantified effects on joist spans, beam spans and ledger bolt spacing. Read 2026-09-07.
- 2018 Seattle Residential Code, Chapter 3 Building PlanningSeattle Department of Construction and Inspections. Table R301.5 on printed page 74, tagged [W][S], with the deck row showing 40 in double parentheses beside 60. Source of the 200 lb guard and handrail load, the 50 lb in-fill load and the footnote wording for each. Read 2026-09-16.
- IRC guards section on UpCodesUpCodes. Shows the opening limitations with both exceptions, the 4 3/8 in stair infill limit and the 6 in triangular opening limit. On 2026-09-16 it defaulted to the Texas Windstorm Insurance Association Residential Code 2024, where the section is numbered R321, so check the code named at the top of the page.
- ICC Digital Codes: the IRC itselfInternational Code Council. Returns HTTP 403 to this site's fetches, so no figure above was read from it. Listed as the publisher to confirm which edition your jurisdiction has adopted before relying on a section number.
- HomeAdvisor, how much does it cost to build a deckWritten by HomeAdvisor staff writer, reviewed by Andy Kilborn, published 17 June 2026. Railings at $35 to $210 per linear foot, not split by material. Read 2026-09-13.
- HomeGuide, how much does deck repair costWritten by Tamatha Hazen, edited by Kristen Cramer, published 28 October 2025. Railing replacement at $20 to $250 per linear foot and post replacement at $150 to $500 per post. Read 2026-09-15.
Figures here last checked against the source documents on 2026-09-16. Codes are amended locally; confirm against the edition your jurisdiction enforces.
Every guide on this site: Guides.