Today we’ll walk through how we built a simple, affordable DIY deck gate to keep our dog, Burger, from escaping. He loves to nap in the sun on the deck, but would sometimes chase squirrels and wander off. With a newborn and a toddler at home, we also wanted something that would help keep the kids safe. The whole project took a few hours and cost under $30 per gate.

We don’t have a yard fence, and Burger has been getting bolder about roaming into the neighbor’s yard. Our temporary solution had been leaning plywood boards across the opening. It worked, but it was flimsy and unattractive, so we decided to build a gate that would integrate with the deck railing.

Materials & Tools
After reading a few helpful tutorials and sketching a plan, we picked up materials at Home Depot. Our list included:
- 2×4 pressure-treated boards
- 2×2 pressure-treated balusters
- Gate hinge and latch set
- Miter saw
- Screwdriver or drill/driver
- 2″ deck screws
- Measuring tape
- Clamps
- Pocket hole jig (optional)
- Carpenter square (optional)

We saved some money by buying longer 10′ boards and having the store cut them down. I built two gates, so my total materials were doubled.
Step 1: Measure and Cut the Wood
Make each gate about 1″ narrower than the opening so it can swing freely. Match the height to your existing railing—our gate ended up 44″ wide and 29″ tall. For a cleaner look we mitered the corners, but straight cuts work fine too.

Use a carpenter’s square to mark any 45° cuts for accuracy. Cut boards in matching pairs (top/bottom together, and the two sides together) so the lengths align and the frame stays square.

Clamping boards together while cutting keeps them aligned and produces cleaner, identical pieces.
Step 2: Assemble the Frame
We used a Kreg pocket-hole jig to create two pocket holes on the ends of the vertical boards for a tight connection, then fastened the frame with 2″ deck screws. If you don’t have a pocket-hole jig, you can drive long screws through the sides—either method works.


Step 3: Add Balusters
To match our deck railing we attached 2×2 balusters vertically. Measure the spacing of your existing railing to determine how many will fit—our gate held five. Start by attaching the center baluster top and bottom with two screws, then add the remaining balusters evenly spaced.

Making a spacer from scrap wood ensures consistent gaps between balusters and speeds installation.
Step 4: Hang the Gate
We used an economical hardware kit that included two T-hinges and a latch. The hinge length should be roughly one-fifth the gate length—in our case 8″ hinges worked well.

Prop the gate with scrap wood and mark hinge placement before fastening. On one gate the top hinge conflicted with the existing railing, so we mounted it slightly lower. Once stained to match the deck, the difference is subtle.

Attach the latch on the opposite side and test the swing and closure. Some people install an anti-sag kit to keep the gate square over time; we skipped it for a cleaner look since our gates are relatively small and light.


One gate was at a corner where we couldn’t attach hinges to a post, so we fastened them to the horizontal rails and used small scrap blocks (the mitered corners we cut off) to give the hinges a secure surface. After staining, those blocks blend in nicely.

Step 5: Stain or Seal
Wait 2–3 weeks for pressure-treated wood to dry before staining or sealing. Applying finish too soon can cause bubbling or peeling. We used the same stain and sealer previously applied to our deck so the gate would match.

Both gates took about three hours to build. Our total material cost for both was roughly $53 ($23 for wood and $30 for hardware). The gate has been very effective at keeping Burger on the deck. While a small chihuahua could squeeze through a gap if determined, Burger hasn’t tried—he’s the same pup who was once stopped by a plywood sheet.

We don’t let our kids play unsupervised on the deck yet, but these gates will help prevent accidental falls down the stairs as they get older and more mobile.
More Deck DIY Ideas
If you enjoy deck projects, here are a few topics you might consider next: stripping and cleaning a deck, patching holes, staining and sealing, or building a full deck. These projects helped us improve and maintain our outdoor space over time.