How to Build a Pergola on a Deck for a Shady Oasis

Shade your deck in style with a DIY pergola

A beautiful farmhouse with an attached to the deck pergola
Photo: Iriana Shiyan / Adobe Stock
A beautiful farmhouse with an attached to the deck pergola
Photo: Iriana Shiyan / Adobe Stock
Get quotes from up to 3 pros!
Enter a zip below and get matched to top-rated pros near you.
Geo Icon

A pergola is the cherry on top of a stylish, breezy deck that’s sure to become the focal point of your outdoor space. These shade-giving structures open up a world of options for customization, plus if you’re an experienced builder, you can DIY a pergola on deck upgrade and save yourself the extra labor costs. Here’s your step-by-step guide on how to build a pergola on a deck.  

What Are the Benefits of Adding a Pergola on a Deck?

So, what does a pergola do, and why should you build one on a deck? Building a pergola on an existing deck adds fresh, modern style to your outdoor space. The rafters provide shade from the sun’s harsh rays, while the open design allows for optimal airflow, helping to keep your deck cooler.

If you want extra shade or protection from the elements, pergolas are also easy to customize. You can add additional wooden lattices to cast extra criss-cross shade, a variety of stylish covers for full-shaded protection, or a clear polycarbonate covering to shield your outdoor space from the rain and snow while still letting in the sunshine.

Prepping to Build a Pergola on a Deck

Selecting quality materials is critical when it comes to building a safe, long-lasting pergola. While there are many options for the structure, pressure-treated pine, cedar, or vinyl are the best options. 

As for the hardware, it needs to be tough to support the posts and roof. Post bases and timber bolts made of galvanized steel with a powder-coated finish are the best choices. If you don’t have those available, make sure all of your hardware is exterior-grade to resist corrosion from the elements.

How to Build a Pergola on a Deck

Once you have your plans and supplies, you’re ready to start the project. Here’s how to build a pergola on a deck.

1. Attach the Post Bases to the Deck Joists

Your pergola will need at least four support posts that are securely connected to the deck’s supportive joists. Locate your deck’s supportive joists and install the pergola post base brackets with a lag bolt (the brackets will have a hole in the middle for attaching them).

2. Pre-Drill a Hole in the Bottom of Each Post

Before lifting the supportive posts in place, pre-drill a hole in the bottom. The lag bolt on the brackets should fit in this hole, allowing the posts to sit flush with the ground.

3. Lift and Brace the Support Posts

Now, lift each support post into the brackets and use a level to ensure it’s plumb. Brace each post by nailing a small 2-by-4 board to each side of the post and an additional 2-by-4 board that pivots and reaches the deck. 

4. Install the Beams

At this point, you’re ready to install the beams, which hold up the rafters and link the posts to the house. Start by drilling at least two pilot holes all the way through the beam and post before clamping the beam to the post to complete the connection. Use galvanized carriage bolts to secure them together, then repeat on the opposite side.

5. Attach the Rafters

If desired, cut decorative edges on your rafters using a jigsaw or a sawhorse before attaching them. Now you can attach your rafters per your design (keeping them around two inches apart is usually a good rule). Screw each rafter into the beams at an angle.

6. Customize Your Pergola

Now that all the building is out of the way, it’s time for the fun part: customizing your pergola. You can paint or stain it and add roofing materials for extra protection. You can also hang cafe-style lights, attach breezy curtains around the perimeter, and bring in furniture to create your dream entertaining space. For extra fragrance and greenery, you can hang plants from the pergola’s rafters and add climbing plants for pergolas, such as wisteria, climbing hydrangea, and honeysuckle.

Safety Tips for Building a Pergola on a Deck

A luxurious deck with a gray sofa and a pergola providing shade
Photo: Photographee.eu / Adobe Stock
  • Be sure to don the proper protective gear, including work gloves and eye protection.

  • Make sure the pergola is securely mounted before taking any breaks or calling it quits for the day—even if it appears to stand on its own, it can still fall and cause major damage.

  • Do not secure the pergola to the deck boards; instead, attach the pergola’s posts to the deck’s supportive joists.

  • If in doubt about your pergola’s safety, consider bringing in a pro.

DIY vs. Hiring a Pro

Building a pergola on a deck is an advanced-level DIY that can be tricky to master without solid know-how for designing and building structures. While cost savings from DIY builds can be tempting, it’s often best to hire a local pergola contractor if you’re not totally confident. Experienced pros will know how to safely build a pergola on your current deck setup. They'll also work with you to create a pergola that looks fabulous and will last for years to come.

Frequently Asked Questions

It’s best to opt for a lightweight roof, as a heavy roof adds a lot of weight and pressure to the support posts and hardware and destabilizes the structure. Vinyl is a good, lightweight option, as is a nice open trellis, louvered aluminum or vinyl slats, or fabric panels. Clear polycarbonate is another great option that offers seamless shelter and additional UV protection without completely obscuring the sunshine. You can also choose retractable coverings or an awning that you only use in wet weather or when you need additional shade.

Pergolas and similar overhead outdoor structures will typically be subject to building code regulations. Every municipality is different, and some may have specs or permit requirements, so it’s important to double-check. Some HOAs may also have restrictions on what you can build, so be sure to check with your HOA as well (if applicable).

A concrete base—or concrete footings, more specifically—is necessary for a freestanding pergola build. A pergola is top-heavy and can’t stand on its own, so it will always need some type of base or support. If you’re attaching a pergola to a deck, the deck’s supportive joists will act as the support, so there will be no concrete base or footings necessary.

Yes, it’s definitely possible to build a pergola on an existing deck. All you need to do is attach the pergola support beams to the deck’s joists and build up from there. Beware that mistakes can damage your deck, so if you’re at all unsure of the process, play it safe and hire a pro for your custom build.

Need professional help with your project?
Get quotes from top-rated pros.
The homeowners guide to deck & porch contractors
From average costs to expert advice, get all the answers you need to get your job done.
white trellis with pink flowers
Dec 18, 2023
Dec 18, 2023
Trellises are structural pieces that add to your garden, but they can also add to your bills. Keep reading to find out how much a trellis costs to build.
Couple sitting on a deck by fire pit drinking wine
Aug 23, 2024
Aug 23, 2024
Ipe decking costs vary depending on size, construction, finish, and whether you DIY the job. Learn more about how to budget for this project.
modern wooden deck attached to house
Nov 30, 2023
Nov 30, 2023
The average cost of pressure-treated decking is between $4,800 and $8,000, depending on the type, size, and labor. Here’s how much PT decking could cost you.
a light wood pool deck surrounding a square pool, with five deck chairs and grass
Jan 9, 2024
Jan 9, 2024
Take your pool to the next level by adding a deck. A pool deck costs, on average, around $5,000. This guide breaks down the cost to build a pool deck, which fluctuates based on the size, material used, and terrain you live on.
A luxurious lanai patio with an indoor pool
Jan 17, 2024
Jan 17, 2024
Love the outdoors? A lanai is a luxurious way to create an oasis in your home. Here's how to differentiate between a lanai and a patio or veranda.
group of friends having lunch on deck of home
Jan 23, 2024
Jan 23, 2024
Expand your outdoor living space with the best type of deck for your home. Learn about the different types of decks and when to use them.
Share project details to get started.