We built a simple, attractive DIY deck gate to keep our dog Burger from slipping off the deck — and to help protect our toddler and newborn when they’re outside. He loves lounging in the sun, but will bolt after a squirrel if given the chance. The gate integrates with the existing railing, took only a few hours to build, and cost far less than a premade option.

We don’t have a yard fence, and Burger had started wandering toward the neighbor’s yard. Until now we’d propped a plywood sheet across the opening. It worked for a time, but it was ugly and unstable, so we decided to build a proper gate that matches the deck and stays secure.

Rather than a freestanding gate, we wanted something fixed to the deck railing. That gave it a cleaner look and a more permanent function without breaking the budget.
Material & Supply List for a DIY Deck Gate
I reviewed a few tutorials, measured the openings, sketched a plan and bought supplies. Below is what we used for each gate:
- 2×4 pressure-treated boards (for frame)
- 2×2 pressure-treated balusters (vertical slats to match the railing)
- Gate hinge and latch set
- Miter saw (or circular saw with guide)
- Screwdriver or drill/driver
- 2″ deck screws
- Measuring tape
- Clamps
- Pocket hole jig (optional for cleaner joints)
- Carpenter square (helpful for precise miter cuts)

I saved money by buying a few longer 10′ boards and having the store cut them down. The photo shows materials for one gate; I built two, so my total material count was doubled.
Step 1: Measure and Cut the Wood
For a smooth swing, make each gate about 1″ narrower than the opening. Match the height to your existing railing — ours ended up 44″ wide by 29″ tall. We chose mitered 45° corners for a polished look, but straight cuts are fine too.

Use a carpenter’s square to mark accurate 45° cuts. Cut top and bottom boards together, and cut the two side pieces together — pairing cuts helps keep the frame square. Clamping paired boards on the saw makes the cuts match precisely.

Clamping the boards while cutting reduces movement and ensures the pieces line up.
Step 2: Assemble the Gate Frame
I used a pocket hole jig to make two pocket holes at the ends of the vertical boards, then joined the frame with 2″ deck screws. If you don’t have a pocket-hole jig, driving long screws through the sides will also work; pocket holes just give a cleaner, tighter joint. Fill pocket holes later with wood putty if you want a smooth appearance.


Step 3: Attach Balusters
We added 2×2 balusters vertically to match the existing railing. Measure the spacing of the deck’s balusters and cut the gate’s balusters to the same length. We had room for five balusters across our gate. Install the center baluster first, fastening it to the top and bottom rails with two 2″ deck screws. Use a scrap-wood spacer to keep even spacing between balusters as you work.

Step 4: Hang the Gate with Hardware
We used an inexpensive hardware kit with two T-hinges and a latch. As a general guide, hinge length should be roughly one-fifth the gate length; our 8″ hinges worked well. Prop the gate in place with scrap wood to find the best hinge locations, then attach the hinges and the latch with the provided screws.

One corner gate required some creativity: we couldn’t mount the hinge directly to the post, so we screwed on small wood blocks (leftover mitered scrap) to give the hinge a solid mounting surface. Once stained, the blocks blend into the railing.


Some builders add an anti-sag kit to keep larger gates square over time. We skipped it for now to preserve a simple look since our gates are light and not particularly large, but it’s an option if you’d like extra rigidity.


Step 5: Stain or Seal the Gate
Wait roughly 2–3 weeks for pressure-treated wood to dry before staining or sealing; doing it too soon can cause bubbling or peeling. We used the same stain and sealer previously applied to our deck so the new gates match the rest of the railing.

The two gates took about three hours to build in total. Our out-of-pocket cost was modest: about $23 for the wood and $30 for hardware, for a total around $53. The gates now keep Burger on the deck and make the space safer for our kids when they’re playing outside.

Even though our children don’t play unsupervised on the deck yet, the gates prevent accidental tumbles down the stairs and provide peace of mind as our newborn grows and starts to explore.
More Deck DIY Projects
If you enjoy deck projects, here are a few more ideas we’ve tackled that you might find helpful:
- How to Strip & Clean a Deck
- How to Patch a Hole in a Deck
- How to Stain & Seal a Deck
- How to Build a Deck