Basement to Roof

Outdoor Builds

How to Build a Deck to Code

Updated

The numbers below come from the deck section of the International Residential Code (IRC section R507). Most US towns build their deck rules on it, and the industry's prescriptive deck guide (known as DCA 6) follows the same approach. Your town may use an older edition or add its own changes, so confirm with the building department before you buy lumber.

Before You Dig: Permit, Utilities, and Design

Get a permit. Almost every jurisdiction requires one for decks attached to a house, decks more than 30 inches above grade, or decks over a set size (often 200 sq ft). Detached accessory buildings get their own size cutoffs, and a small backyard shed is often exempt from a building permit. The permit drawing you submit is your build plan. Inspections usually happen at three points: footing holes before the pour, framing before the decking goes on, and a final.

Call 811 at least a few business days before digging. It's free, and hitting a gas or electric line with a post-hole digger is a real risk.

Decide these things on paper first:

  • Attached or freestanding. An attached deck hangs one side on a ledger bolted to the house. A freestanding deck has its own beam and posts next to the house. Freestanding takes a few more footings but avoids cutting into the siding and the most common failure point. It's the right call when the house has brick or stone veneer, a cantilevered floor, or a rim joist you can't inspect. A roofed space against the house is a different build, since a covered porch needs footings and posts sized for the roof load too.
  • Height. Any walking surface more than 30 inches above grade needs guards. Over about 8 feet high, you need to think about bracing and taller posts.
  • Size and shape. Plan around lumber lengths. Joists come in 2-foot increments (8, 10, 12, 14, and 16 ft), so a 12-foot-deep deck wastes less than an 11-foot-deep one.
  • Decking material. Pressure-treated pine, cedar, composite, and PVC all sit on the same pressure-treated frame. The decking choice changes joist spacing, which is covered below.
  • Loads. The standard tables assume 40 psf live load plus 10 psf dead load. Hot tubs, heavy planters, outdoor kitchens, and ground snow loads above 40 psf all need engineering. Building a rooftop deck is a different project, since the roof framing and its membrane stand in for footings and posts. Shade structures change the math as well, and a freestanding gazebo on its own footings keeps roof loads off the deck frame.

What a Deck Costs in 2026

Item Typical 2026 price range
Installed deck, pressure-treated decking $20–$45 per sq ft (ground-level at the low end, raised at the high end)
Installed deck, composite decking on a PT frame $30–$60+ per sq ft
PT deck boards, material only about $3–$7 per sq ft
Composite deck boards, material only about $5–$15 per sq ft
5/4×6×8 PT ground-contact deck board about $6 each
1×6×8 composite board about $20–$35 each, depending on brand and line
6×6×10 PT ground-contact post about $25–$40
80 lb bag of concrete mix about $5–$10

For a 300 sq ft deck, materials alone typically come to about $4,500–$7,500 with pressure-treated decking or $7,500–$13,500 with composite. Railings and stairs often add 20–40% to the total and are usually the item people underbudget. Prices vary a lot by region and season, so get current quotes from your yard.

How a Deck Is Built, Ground Up

Every deck has the same load path:

Footings → Posts → Beams → Joists → Decking, with guards and stairs added last.

An attached deck replaces one beam line with a ledger on the house. Each step below follows that order.

Step 1: Lay Out the Deck

  1. Mark the outside edge of the ledger, or the house-side beam line, on the house.
  2. Set batter boards about 2 feet past each outside corner and run mason's string to mark the outside of the frame.
  3. Square the layout with the 3-4-5 method: measure 3 ft along one line and 4 ft along the other, then adjust until the diagonal between those marks reads exactly 5 ft. Use 6-8-10 or 9-12-15 on bigger decks.
  4. Check that both full diagonals match. If they're within 1/4 inch, the layout is square.
  5. Mark the footing centers. The beam line usually sits 1–2 feet in from the outside edge so the joists cantilever a little. That hides the beam and gives a cleaner look.

Step 2: Footings

Footings carry the entire deck, and an undersized or shallow footing is the root of most sagging, heaving decks.

Depth: At least 12 inches below undisturbed soil, and below your local frost line wherever frost is a concern. Frost depth runs from about 12 inches in the Deep South to 48 inches or more in the northern states. The building department will tell you the number.

Size: Footing size depends on how much deck area each post carries, which is its tributary area. Typical minimums from the code's footing table, at 40 psf live load on average (1,500 psf) soil:

Deck area carried by one post Square footing Round footing Min. thickness
60 sq ft 17" × 17" 19" dia. 6"
100 sq ft 22" × 22" 25" dia. 8"

A plain 8- or 10-inch tube full of concrete is often not enough bearing on its own. The usual fixes are a belled base or a wider pad at the bottom of the hole, or a tube set on a precast or poured spread footing.

Pouring:

  • Have the holes inspected before you pour.
  • Set post bases in the wet concrete, or place wedge anchors after it cures. Use a string line so the bases line up.
  • Keep the top of the concrete a few inches above grade so the post base stays dry.
  • One 80 lb bag yields about 0.6 cubic feet. A 12-inch tube 42 inches deep holds about 2.75 cubic feet, so it takes about 5 bags. Large footings or many holes are worth a short-load ready-mix delivery or a mixer rental.

Posts and concrete: Set posts on top of the footing with a manufactured post base, or embed them at least 12 inches into the concrete. Bases keep the end grain out of standing water and are the better choice. Don't bury a post in a concrete-filled hole with dirt around it.

Step 3: The Ledger (Attached Decks Only)

Ledger failures cause the worst deck collapses. This connection needs the most care of anything on the build.

Section through a deck ledger bolted to the house rim joist, showing the housewrap, Z-flashing cap, butyl membrane and staggered 1/2 in. lag screws.about 2 in.Siding cut backHousewraplaps over flashingsheds outwardZ-flashingcap over topFloor framingSolid 2×rim joistDeck joist beyond1/2 in. lag screwsstaggeredLedger: 2×8 min.pressure-treatedButyl membranebehind and over top
A cut through the ledger connection, taken between two deck joists. The siding comes off, the ledger bolts to a solid rim joist, and the housewrap, Z-flashing and butyl membrane overlap so water sheds outward, never toward the rim joist.
  • Remove the siding where the ledger goes. Never bolt a ledger through vinyl, fiber-cement, or wood siding.
  • Confirm what's behind it. You need a solid 2× rim joist, or an engineered rim board at least 1 inch nominal. Never attach a ledger to brick or stone veneer, hollow block, a cantilevered floor, or a bay window. Never use lead or plastic anchors. Build freestanding in those cases.
  • Ledger size: At least a 2×8 of pressure-treated lumber, and at least as deep as the joists it carries.
  • Flash it. Lap housewrap over a metal or approved non-metallic flashing. Metal flashing must be at least 0.019 inch thick, and plain aluminum shouldn't touch treated lumber. Add self-adhered butyl membrane behind and over the top of the ledger, then a Z-flashing cap over the top. Water must shed outward, never toward the rim joist.
  • Fasten it with 1/2-inch hot-dip galvanized or stainless lag screws or through-bolts, or code-approved structural ledger screws. Never use nails. For 12-foot joists at 40 psf, the code spacing is:
  • 1/2" lag screws: 15 inches on center
  • 1/2" through-bolts: 29 inches on center
  • Stagger the fasteners top and bottom, about 2 inches from the edges. Longer joist spans need tighter spacing, so check your code's ledger table.
  • Lateral load connection: The code also expects the deck to be tied into the house floor framing. That means either two hold-downs rated at 1,500 lb or more, each within 24 inches of the deck's ends, or four rated at 750 lb or more. Many inspectors ask for this.

Step 4: Posts and Beams

Posts: Use 6×6 pressure-treated, ground-contact rated posts. The code still allows 4×4s in limited cases, but DCA 6 uses 6×6 as the minimum. A 6×6 also gives the beam full bearing and resists racking far better. Southern pine 6×6s can go up to about 14 feet tall under the code tables. Taller posts need engineering.

Beams:

  • Built-up beams are usually two or three 2×8s to 2×12s. Fasten the plies with two rows of 10d nails at 16 inches on center, or with structural screws, and stagger the splices over posts.
  • The beam must bear on the post, either in a notch cut into a 6×6 or on a manufactured post-cap connector. Bolting a beam to the side of a post with nothing under it is not allowed under DCA 6 and is a common reason inspections fail.
  • Minimum bearing is 1-1/2 inches on wood or metal and 3 inches on concrete.
  • A beam may cantilever past a post up to one-quarter of its span between posts.
  • Size the beam from your code's beam span table or have it engineered. The size depends on beam span, joist span, and species, and the table changed in recent code editions.
  • Bracing: Decks more than a few feet high benefit from knee braces or diagonal bracing, and some jurisdictions require them.

Step 5: Joists

Joists must be continuous from ledger to beam, or beam to beam, and sized from the span table. Spans below are for No. 2 grade lumber, wet service, 40 psf live load and 10 psf dead load, measured as clear span.

Deck materials: boards, joists and fasteners

29 deck boards, 12 ft long, for 144 sq ft

26 rows of 5.5 in boards with 1/8 in gaps.

10 joists at 16 in on center, each 12 ft, the two outer ones included; 10 joist hangers at the ledger; a ledger and a rim joist 12 ft each.

520 deck screws, two at every place a board crosses a joist.

This counts pieces; it does not size them. Joist and beam sizes, spans, posts, footings and the ledger's connection to the house come from the span tables in your building code and the permit drawings. Most towns require a permit for a deck; the building department says what it needs.

Open the deck materials calculator on its own page

Southern Pine

Joist 12" o.c. 16" o.c. 24" o.c.
2×6 9'-11" 9'-0" 7'-7"
2×8 13'-1" 11'-10" 9'-8"
2×10 16'-2" 14'-0" 11'-5"
2×12 18'-0" 16'-6" 13'-6"

Douglas Fir-Larch, Hem-Fir, Spruce-Pine-Fir

Joist 12" o.c. 16" o.c. 24" o.c.
2×6 9'-6" 8'-4" 6'-10"
2×8 12'-6" 11'-1" 9'-1"
2×10 15'-8" 13'-7" 11'-1"
2×12 18'-0" 15'-9" 12'-10"

Joist cantilevers over the beam depend on the joist size and the span behind the beam. A few Southern Pine examples:

  • 2×8 with an 8 ft back span: 2'-0" overhang
  • 2×10 with a 12 ft back span: 3'-0"
  • 2×12 with a 16 ft back span: 4'-0"

The table doesn't allow some combinations at all. For example, a 2×6 can't cantilever when its back span is 10 ft or more. Keep in mind that a full cantilever also increases the load on the beam.

Framing details that matter:

  • Joist hangers at the ledger and at any flush beam. Fill every nail hole with the hanger maker's specified fasteners, not drywall or deck screws.
  • Hurricane ties or rafter ties where joists sit on top of a beam.
  • Crown up: sight down each joist and install it with the bow facing up.
  • Blocking at mid-span on longer spans keeps joists straight and stiffens the floor.
  • Doubled rim joists on the outside edges, plus extra blocking wherever guard posts will mount.
  • Joist tape on the top of joists and beams. It's a small cost, and it stops water from sitting in screw holes and checks, which is where frames rot first.
  • Hardware: Today's copper-based lumber treatments corrode plain steel. Use G185 hot-dip galvanized or a ZMAX-equivalent coating at minimum, and stainless steel near salt water or pools.
  • Lumber rating: Buy ground-contact rated treated lumber for posts, and use it for beams and joists too. It costs little extra, and framing that stays damp under the decking rots faster than people expect.

Step 6: Decking

Joist spacing must match the decking:

Decking Laid square to joists Laid diagonally
5/4 (1-1/4") wood 16" o.c. max 12" o.c. max
2× wood 24" o.c. max 16" o.c. max
Composite or PVC Per manufacturer, usually 16" o.c. Usually 12" o.c.

Composite makers' warranties depend on following their spacing, and some lines need 12 inches for stairs or for steep diagonal patterns.

Installation:

  • Gaps: Wet pressure-treated boards shrink, so butt them tight or nearly tight. Kiln-dried wood typically gets about 1/8 inch. For composite, use the manufacturer's spacing and end-gap chart, which changes with temperature.
  • Fasteners: Use two coated or stainless deck screws per joist, or hidden clip systems for grooved boards. Pre-drill near board ends in hardwood and cold-weather composite.
  • Butt joints must land on a joist. Doubling the joist or adding a cleat at each joint gives both boards full bearing. A picture-frame border with a breaker board avoids butt joints and looks finished.
  • Snap a chalk line every few rows to keep courses straight.

Step 7: Guards (Railings) and Stairs

Guards are required wherever a walking surface is more than 30 inches above grade within 36 inches of the edge.

  • Height: 36 inches minimum, measured from the decking surface. Some local codes require 42 inches.
  • Openings: A 4-inch sphere must not pass through anywhere.
  • Strength: Must resist a 200 lb concentrated load at the top in any direction. That depends almost entirely on how the posts attach to the framing. Notched 4×4s held with two carriage bolts routinely fail this test. Use through-bolted posts with tension hardware tied back to the joists, or a manufacturer-tested post-mount system. Newer codes add specific rules for attaching guard posts to framing.

Stairs:

  • Rise: No riser taller than 7-3/4 inches.
  • Tread depth: At least 10 inches.
  • Neither may vary by more than 3/8 inch within a flight, so calculate total rise and divide evenly before cutting stringers.
  • Width: 36 inches clear minimum.
  • Stringer spacing: Usually 16 inches or closer for composite treads, and no more than 24–36 inches for 2× wood treads, depending on species and code.
  • Landing: Required at the top and bottom. A concrete pad or compacted gravel pad at the bottom keeps stringers off the dirt.
  • Handrails go on flights with four or more risers, set 34 to 38 inches above the tread nosings, and must be graspable.
  • Stair lights at each riser or on the posts are worth the small cost.

Freestanding Deck Option

To skip the ledger entirely, run a second beam and a row of footings about 2 feet out from the house. Everything else stays the same: footings, posts, beam bearing, and joist spans. A freestanding deck more than a few feet high needs diagonal bracing at the posts, because it no longer gets lateral support from the house.

For low, simple decks, some builders use precast deck blocks. Many jurisdictions don't accept them for permitted work, and they aren't frost-protected, so check before relying on them.

Mistakes Inspectors See Most

  1. Ledger through siding, or with no flashing
  2. Beams bolted to the side of posts instead of bearing on a notch or cap
  3. Footings too small or too shallow for the soil and frost line
  4. Joist hangers installed with the wrong nails, or with holes left empty
  5. Guard posts held by two bolts in a notched 4×4 and nothing else
  6. Uneven stair risers, usually because the bottom landing height was guessed
  7. Plain steel or electroplated fasteners in treated lumber
  8. Joists overspanned, or set too far apart for composite decking
  9. No lateral load connection to the house

Realistic Timeline for a DIY Build

For a ground-level to moderately raised 12×16 deck built by two people:

  • Day 1: Layout, digging, footing inspection
  • Day 2: Pour footings, then let them cure (1–3 days)
  • Days 3–4: Ledger, posts, beams
  • Days 5–6: Joists, hangers, blocking, framing inspection
  • Days 7–8: Decking
  • Days 9–11: Stairs and guards, final inspection

Railings and stairs almost always take longer than expected. Many homeowners build the frame and decking themselves and hire out the railings and stairs, and that's a reasonable split.

Pre-Inspection Deck Checklist

  • [ ] Permit pulled, 811 called
  • [ ] Footings sized for tributary area, below frost line, inspected
  • [ ] 6×6 posts on manufactured bases
  • [ ] Beams bearing on notches or post caps, sized from the table
  • [ ] Ledger flashed, on solid rim joist, lagged or bolted at code spacing
  • [ ] Lateral load hardware installed (attached decks)
  • [ ] Joists sized from the span table, crowned up, hangers fully nailed, joist tape on top
  • [ ] Joist spacing matches the decking
  • [ ] Guards 36" minimum, 4" sphere rule, posts tied into framing
  • [ ] Stairs at 7-3/4" max rise and 10" min tread, consistent within 3/8"
  • [ ] All hardware G185 galvanized or stainless