How to Build a Deck Railing in 10 Steps

Putting the finishing touches on your deck requires precision and skill

Woman standing on a backyard deck enjoying coffee
Photo: Halfpoint Images / Moment / Getty Images
Woman standing on a backyard deck enjoying coffee
Photo: Halfpoint Images / Moment / Getty Images
SKILL LEVEL
Intermediate
COMPLETION TIME
2 days
COST
$500–$950
Get quotes from up to 3 pros!
Enter a zip below and get matched to top-rated pros near you.
Geo Icon
What you'll need:
TOOLS
  • Wrench
  • Tape measure
  • Chalk
  • Circular saw or miter saw
  • Clamps
SUPPLIES
  • 4x4 pressure-treated lumber
  • 2x4 pressure-treated lumber
  • 2x2 pressure-treated balusters
  • Deck bracing (optional)
  • Deck anchors

When refurbishing a deck or building a new one, a railing is a key part of the project. It creates a finished look and helps the deck adhere to safety codes, since a deck railing is required if your deck is at least 30 inches off the ground. Knowing how to build a deck railing gives you a project you can take pride in whenever you step outside. Let’s walk through the steps.

  1. Evaluate Your Deck Frame for Stability

    Elevated patio deck foundation footings
    Photo: msderrick / E+ / Getty Images

    Deck railings require a stable foundation. If you're adding or replacing railings on an existing deck, thoroughly inspect the​​ frame for common deck problems that require repair.

    Your deck's ledger board, the horizontal board that attaches the deck to your home, should be securely bolted to the house. If not, tighten bolts and reinforce weak spots. With the frame attached, inspect the joists for sagging or warping. Add deck anchors and bracing as needed.

    If you discover serious structural problems, stop your deck railing project here and call a pro to repair your deck frame before you continue.

  2. Measure and Set Spacing for Posts and Railings

    Deck railing measurement requirements illustrated, with the railing height being minimum of 36 inches

    To build a deck railing, you can use 4x4 lumber for your deck posts, 2x4 lumber for your railings, and 2x2 lumber for your balusters. To determine optimal lengths and spacing for your posts and railings, keep the following in mind:

    • Most building codes regulate deck railing post spacing and height.

    • Most codes allow no more than six feet between posts, measured from the post’s center.

    • Most codes require deck railings to be at least three feet tall above the deck surface.

    • The bottom of each post should be flush with the bottom edge of the end joist.

    • Plan on having posts by the house, outside corners, and the tops of staircases.

    Determine the number of posts you'll need between two corners by measuring the distance, dividing by your spacing, and subtracting one. For example, if the distance between corners is 18 feet with six feet between posts, divide 18 by six. The result is three. Minus one is two. This means you'll need two posts between the corners. Mark where each post will go using chalk.

  3. Cut the Posts to Size

    Carpenter cutting wooden boards on the patio
    Photo: AleksandarNakic / E+ / Getty Images

    With your measurements in hand, don your mask and safety glasses. Use your saw to cut each post to length, accounting for the full height of the post from the bottom of the end joist to the height above the surface, as required by your local building codes.

  4. Place the Post

    Place your first post in the location you marked with chalk and use clamps to keep it in position. Screw the post in place flush with the bottom of the end joist, making sure it's plumb.

  5. Attach Bracing and Deck Anchors Inside the Joists

    Access the joists from below or by removing the decking boards around the post. Use a drill and deck screws to install extra bracing by the post between the end joist and floor joist if there isn’t a brace already. 

    Line up an anchor about two inches from the top of the joist and flush with the brace. Attach it to the bracing with screws.

  6. Bolt the Post in Place

    Drill a hole through the anchor into the post. Run a carriage bolt through it to secure the post with a washer and nut. Use your wrench to secure the connection tightly. 

    Drill a second bolt hole through the post and joist about two inches from the bottom of the joist and run a second carriage bolt through, again securing it with a washer and nut.

  7. Secure the Remaining Posts

    Repeat the previous three steps until all of your posts are securely fastened to the end joist. Reinstall any decking boards you removed.

  8. Add the Top and Bottom Deck Rails

    Person installing a bottom deck rail
    Photo: K Neville / iStock / Getty Images Plus / Getty Images

    Clamp the lumber for the bottom rail to the posts at about 3.5 inches above the decking surface. Secure the rail to the posts with decking screws. Do the same with the top rail, making the top of the rail flush with the top of the post.

  9. Install Balusters

    Refer to local codes to determine the required spacing for balusters. Many codes require a spacing of 3.5 inches, or about 3 balusters per foot. Drill pilot holes in the top and bottom of each baluster in alignment with the top and bottom rails, then secure them using nails.

  10. Install Post Caps and Trim

    Patio deck railing with post caps and trim
    Photo: Bryan Chavez / iStock / Getty Images Plus / Getty Images

    Top your posts with post caps and add trim skirts at the bottom of each post to conceal gaps and add moisture protection.

Mistakes to Avoid

Deck railing installation is an intensive project with a lot of steps. Even if you have the necessary tools and carpentry skills, you'll still want to look out for several mistakes that DIYers commonly make:

  • Using the wrong hardware: Ensure that your screws, nails, carriage bolts, washers, and nuts are all rated for pressure-treated lumber.

  • Ignoring building codes: To ensure that your railings are adequately supported and meet safety standards, follow local building codes.

  • Overlooking instructions: Many pre-made railings and infills include manufacturer recommendations—the instructions that come with your product should be your primary source of information over other guides.

DIY vs. Hiring a Pro 

The cost to replace deck railings as a DIY project varies by the size of your deck and the quality of the materials, but you can expect to spend at least $500 and about $950 on average. Compare that to the cost of hiring a pro for the job, which averages about $1,100 but can range anywhere from $650 to $3,400, and you can see the potential savings DIY can afford.

However, installing deck railings safely and properly requires specific carpentry skills, tools, and knowledge of local building codes. Mistakes can result in a finished project that doesn't last or compromises safety for you, your family, and your guests due to wobbly railings. Ensure the job gets done right the first time by contacting a few local deck builders for estimates.

Frequently Asked Questions

Apply a wood stain or sealant to properly maintain a wood deck railing and keep it looking new. Sealants protect wood from moisture and weathering. Regularly inspect the railing for loose screws, damaged balusters, and other signs of wear to make timely repairs. Routinely clean the railing using mild soap, water, and a soft bristle brush.

The four-inch ball rule for railing is a rule of thumb used when installing or replacing railings on stairways and decks. It refers to the gaps that naturally occur between balusters or other infills in a railing system. The rule states that a four-inch sphere should be unable to pass through any of the gaps. This helps prevent the possibility of people or animals slipping through.

Need professional help with your project?
Get quotes from top-rated pros.
The homeowners guide to deck and porch services
From average costs to expert advice, get all the answers you need to get your job done.
A deck with cable railing
May 26, 2025
May 26, 2025
If you’re updating a deck or staircase with a modern railing, you may be wondering how much cable railing costs. We dive into the cost factors you need to know.
Large vinyl deck
Jun 4, 2025
Jun 4, 2025
Vinyl is a durable and relatively inexpensive choice of decking material. Your vinyl deck cost will depend on labor, the deck size, and more.
friends hanging out on front porch
Jun 3, 2025
Jun 3, 2025
Are your porch columns old or simply unsightly? It might be time to refresh them. Here's a breakdown of the cost of replacing porch columns.
Large wooden deck
May 29, 2025
May 29, 2025
Deck railings keep you safe and give your deck a finished look. Here’s how to install railing posts on a deck to support strong and sturdy railings.
A beautiful wooden deck with white railings
Jun 2, 2025
Jun 2, 2025
Deck board replacement can keep your outdoor space looking good and safe to use. Learn how to replace deck boards yourself.
Couple relaxing on veranda
May 28, 2025
May 28, 2025
Your deck railings help prevent injuries, but only if they’re the proper height. Discover the ideal deck railing height to ensure your safety and compliance with building codes.