clock menu more-arrow no yes mobile

How to Build a Deck Gate

This sturdy but simple exterior gate is affordable, easy to build, and will make any porch or deck a safer place to hang out. Follow this guide to learn how to build a deck gate yourself.

A gate to a deck on the water iStock

Installing a gate on your deck is a great way to make your outdoor spaces feel more safe and secure. And the good news is that building one can be an enjoyable weekend project for anyone who has basic carpentry skills. There are many different ways to build a good-looking and durable gate for a deck, but the design presented here is one of the simplest methods we’ve found. We’ll walk you through the whole project, from preliminary planning to construction and final installation.

Before You Start Building

Illustration of a finished deck gate Ian Worpole

Check with your local building department to see if there is anything you need to do to meet local codes. Typically, there are no building codes governing outdoor gates, unless the gate will be part of an approved enclosure for a pool. Even if there are no special requirements for gates where you live, if it is being used to keep pets or small children safe, you will want to install a childproof latch and make sure the gaps in the gate are small enough that kids or animals won’t be able to fit through.

We’ve chosen this particular style of gate because it is easy to build, it will stay square without any additional bracing, and it closely matches one of the most common styles of wood deck railings. The frame is simply made of four pieces of 2x4 lumber that get screwed together in picture-frame fashion with 45-degree miter cuts at both ends of each piece. A flat piece of 1-inch-thick wood decking makes a decorative cap board on top, which makes for a similar look to the cap on a typical deck railing, and one face of the gate is flanked by vertical balusters spaced less than 4 inches apart. If you want to use a different style of baluster or screening that is a better match for your deck, feel free to adjust the design to suit your needs.

Pressure-treated pine is the most common material for a gate like this, but you can use whatever rot-resistant wood you prefer. Typical alternatives are cedar and redwood, while exotic hardwoods are often reserved for the fanciest of decks. If you’re unsure which wood is best, ask at your local building supply store what carpenters commonly use to build decks and gates in your area.

Determine the Size Gate You Need

How wide should your deck gate be? The right answer is: “whatever fits your needs.” A good rule of thumb is between 36 and 48 inches. Of course, if there’s an existing opening in your deck railing, that’s probably the size to go with.

Grab a piece of paper to write down dimensions as you measure to keep them organized. First, measure the width and height of the opening in your deck railing where you plan to install the gate. You should measure across the top, bottom, and middle to be sure that the opening is a consistent width and measure the height of both sides to be sure the railing is the same height.

Next, use a level and a framing square to see if the railing posts are straight up and down (aka plumb), the tops of the railing and the decking are both level, and the posts are square to the decking. If there are any variations in these dimensions, opt for the narrowest or lowest points when choosing dimensions for your gate.

Ideally, the top of your deck gate will be flush with each of the adjacent railings, and the bottom will be a couple of inches above the surface of the decking. These are just suggestions; you can make the gate at whatever height suits your needs. Plan for the outdoor gate to have a ½- to ¾-inch gap on either side within the opening. These relatively large gaps ensure that the gate doesn’t bind if the posts are a little crooked to begin with or if any of the wood parts swell or move due to moisture and temperature changes throughout the seasons. The gap sizes will also have to match the tolerances of your latch and hinges, so it’s wise to purchase all your hardware before you build the gate and check to see how big of a gap the hardware will span.

Draw a Plan for Your Gate

A deconstructed deck gate with measurements Ian Worpole

It’s a good idea to sketch out a basic drawing to be sure that you’ve gotten all your dimensions correct and that you will cut the parts accurately.

Accounting for the gap sizes you choose for the sides and bottom of the gate, use the measurements you took from the existing deck railing opening to draw up a simple plan showing the proposed gate and how it will fit into your railing.

In our example, the railing is 36 inches high, and the opening is 42 inches wide, so our gate will be 34 inches tall by 41 inches wide, which will allow for 2 inches underneath when flush at the top of the adjacent railings, and a ½-inch gap on either side between the gate and the posts.

Assemble the Deck-gate Frame

The first step in building the gate is to cut the frame pieces. The two horizontal frame pieces will be the full width of the gate, which in our case, is 41 inches. The vertical pieces will be 33 inches, which is the height of the gate minus the 1-inch thickness of the cap board. Mark the lengths of your frame pieces and use the miter saw to cut opposing 45-degree miters on both ends. If you don’t have a miter saw, you can clamp the boards to a workbench and use a circular saw and a speed square to make the 45-degree cuts.

Lay the frame pieces down on a sturdy table or workbench so that all the mitered cuts meet in picture-frame fashion, and clamp them down to the bench. Because of the mitered joints, clamping the pieces to the bench is the easiest way to hold them steady while you fasten everything together. It’s a good idea to use a framing square and tape measure to confirm that your gate’s dimensions are correct and that the corners are all tight and square before driving in the screws

Connections made with wood screws are sturdiest when you drive the screws across the grain of the wood, so you will be installing your screws at a 45-degree angle to the edges of the gate frame–which is perpendicular to the miter joints. Use one 3-inch and one 5- or 6-inch deck screw at each corner, and drive each of these screws down through the edge of the top rail and up through the edge of the bottom rail until the frame is firmly fastened together. To prevent the wood from splitting, drill a hole at the correct angle using a countersink drill bit at each screw location before driving the screws.

Add the Cap Board

The gate in the illustration has a 3¾-inch-wide cap board, which slightly overhangs the gate frame and balusters. To make the cap, cut a 1-inch-thick decking board to the same length as your gate–in our case, 41 inches. Then rip the board to 3¾ inches wide on the table saw.

You will want to round over the edges of the board, both for looks and to make it comfortable to grasp. This can simply be done with several passes of 100-grit sandpaper, or you can use a ¼ -inch roundover bit in a router for a more refined edge.

Clamp the cap board on top of the gate frame with the ends flush with the frame and one edge of the board hanging 1/4 inch over one side of the frame. Fasten the board to the top of the gate frame with several 2½-inch deck screws, making sure that there is one screw about an inch in from each end and that the rest of the screws are spaced about 12 to 16 inches apart.

Lay Out and Install the Balusters

Gate with balusters illustration Ian Worpole

Most building supply stores sell 1½-inch square balusters made of the same lumber as their wood decking, so there’s typically no need to make the balusters from scratch. For child safety reasons, deck guard rails require balusters to be less than 4 inches apart, so we will follow that same guideline for our gate layout and leave a 3¾-inch space between each of them. To make that spacing work out on the example gate, we used eight balusters, with the edge of the first one 1 1/2 inches from the side of the gate. If you’re building a different width gate, you can play with the spacing and number of balusters until you find a layout that works for you.

Cut each baluster 1/2 inch shorter than the height of the gate frame–which in our case makes each baluster 32 1/2 inches long–with a square cut on one end and a miter cut on the other. On the side of the gate where the cap board overhangs enough to cover the ends of the balusters (i.e. opposite the side where you made it overhang 1/4 inch), use a tape measure and pencil to make marks on both the top and bottom frame rails for the location of one edge of each baluster. Be sure to make a small “X” to the side of each mark to remind you which side the baluster goes on.

To prevent the wood from splitting, use a countersink bit to drill holes on the outer face of each baluster about 1 inch in from the top and bottom where you plan to drive the screws. One at a time, lay the balusters down next to the marks, holding the top ends tight to the underside of the cap board, and use 2½-inch deck screws to fasten each of them to the gate. Check your measurements as you go to make sure the balusters are straight and evenly spaced.

Apply an Exterior-grade Finish If You Like

Whether or not you add a decorative or protective finish to your gate is up to you. Many outdoor gates are left unfinished to eventually weather to a gray patina, but there are numerous options for oil finishes, exterior paints, and more that can make your gate last longer and look great. If you do decide to add a finish, you should follow the manufacturer’s preparation and application instructions for the paint or stain you choose. Also note that gates made using wet pressure-treated lumber may need several months of drying time before you can apply a finish.

Install the Deck Gate

To ensure that you get the right spacing on the sides and bottom of your gate, use scraps of wood ripped to the tolerances of your choice as temporary spacers. Remember that for our example gate we’re leaving ½-inch gaps at the posts and a 2-inch space underneath, so we will cut two spacers to those thicknesses.

Once they are all cut, start by laying a couple 2-inch spacers on the deck in the opening in your railing. Set the bottom of the gate on top of them, making sure your balusters are facing outwards away from your deck. Then, on the side where you plan to mount your hinges, slip in a couple ½-inch spacers, and use wood clamps to temporarily hold the gate flush to the post. Adjust the gate so that the inside face is flush with the inside face of the post, and firmly tighten the clamps to hold it steady.

Hold each of the hinges up to the gate and post to get an idea of where they will fit and look best. Use a tape measure to make sure you have them square and level to the gate and make marks with a pencil where the hinge fasteners will go. It’s always a good idea to drill pilot holes for screws or bolts to prevent splitting, so find an appropriate size bit for your hinge fasteners and drill a hole at each mark you made. Then, holding each hinge against the post and gate, so it lines up with the holes you drilled, use the fasteners supplied with your gate hinges to attach each of them to the post and the gate.

Once the hinges are on, swing the gate to make sure it moves smoothly and doesn’t hit the railing at all. If you chose to have smaller gaps where the gate meets the posts, there’s a chance your cap board may rub the railing at the outside corner; you may want to cut or sand the corner a bit if you need more clearance.

The last step is to install the latch. For a basic gate latch, repeat the steps you used for the hinges above. For more complex latches, such as child-safety latches required for pool enclosures, you must follow the specific instructions supplied with the product carefully to get the job done. After that, all there is to do is check that the gate opens and closes well and make adjustments to the latch, if needed. Then relax and enjoy your deck.

What You Need for This Project:



  • (2) 8-foot 2x4s in the lumber of your choice (such as pressure-treated pine or cedar)
  • (8) 1½ x 1½-inch balusters in the lumber of your choice (such as pressure-treated pine or cedar)
  • (1) 5/4 x 5½-inch decking board to use as cap board (such as pressure-treated pine or cedar)
  • (1) box 2½-inch exterior screws
  • (4) 3-inch exterior screws
  • (4) 5- or 6-inch exterior screws
  • (2) heavy-duty 6-inch to 10-inch gate hinges
  • (1) exterior gate latch
  • Exterior stain or paint and painting supplies (optional)
  • 100-grit sandpaper

Note: If you choose to build a larger gate, you may need additional lumber, so check your dimensions before purchasing.