How to Build a Fence in 8 Steps

Kristin Salaky
Written by Kristin Salaky
Updated March 31, 2022
Father and daughter in front of wood fence
Photo: fotostorm / Getty Images

Make your white picket fence dreams a reality

Get quotes from up to 3 pros!
Enter a zip below and get matched to top-rated pros near you.

Installing a wood fence is a great way to boost the curb appeal of your home, add security and privacy, and create a clear delineation between your property and your neighbors. What’s more, with the right materials and tools, you can take on a fence installation project yourself. Read on to learn how to build a fence and how to customize it to your needs.

Difficulty: Intermediate (⅗)

Building a fence requires home improvement skills, as different techniques are involved. From measuring and cutting wood at the correct angle, to digging holes and working with concrete, it can be a challenging, yet attainable DIY project.

Total Project Time: 1–2 days of total working time

Carve out an entire weekend to build a wooden fence in an average-sized yard. If your property is sloped, or if you have a larger lot, expect the project time to increase. Remember, when setting the posts, the concrete mix can take a few days to fully cure, so account for drying time when planning out the project.

Cost: $7–$15 per square foot of lumber

Expect to pay $7 to $15 per square foot for basic materials. If you plan on adding gates and fence post caps, or if you need to purchase tools, the cost will go up. Refer to our Fencing Costs Guide to learn more about some of the different variables that can affect the total price.

Materials

  • Marking spray paint

  • Batter boards

  • Mason line

  • Gravel (optional)

  • Concrete mix

  • 4-by-4-inch pressure treated posts

  • 1-by-2-inch stakes (for the stabilizing brackets)

  • 4-foot scrap pieces of lumber (for the stabilizing brackets)

  • Exterior deck screws

  • 2-by-3-inch or 2-by-4-inch pressure-treated rails

  • 1-½-inch nails

  • Wood fence panels or wood pickets

  • Post caps

  • Galvanized steel finishing nails

  • Wood preservative

  • Sandpaper

  • Primer (if painting the fence)

  • Wood stain or paint

Tools

  • Tape measure 

  • Level

  • Measuring wheel (optional)

  • Rubber mallet

  • Shovel

  • Post hole digger or power auger

  • Tamper (optional)

  • Post level

  • Drill

  • Garden hoe

  • Circular saw

  • Jigsaw (optional)

  • Pneumatic nailer

  • Angled paintbrush

How to Build a Wood Fence: A Step-By-Step Guide

Use this guide to learn how to build a wooden fence in your yard using either panels or pickets. 

1. Make Necessary Preparations and Plan the Layout

Drawing landscaping plans
Photo: foxcub / Adobe Stock

Before you start purchasing materials and breaking ground, finish all the necessary prep work to ensure the fence is both up to code and will last for years to come.

  • Determine your property line: Start by establishing the property lines of your yard by talking with neighbors and checking your survey. Remember, not all lots follow a rectangular or square size, and there may be divots or jogs in the property line to be aware of.

  • Obtain a building permit: You will likely need a local building permit before installing a fence to make sure your plan follows all local building codes. Check with your local city hall or town building inspector to determine the preparations needed on your end to get the permit. For example, many municipalities may require a fee, a copy of the fence plans, and even written consent from neighbors. Moreover, the town may have limitations on how tall the fence can be. 

  • Plan the layout and design of the fence: Take some time to determine the height, the type of wood (more on that later), and the style of your fence. Choose the location for the gates, and use a marking spray paint to get a better idea of how you want foot traffic directed.

  • Calculate the total square footage: Figure out the total square footage of the fence using a long tape measure or a measuring wheel for larger areas. This will help you get accurate prices when it’s time to buy materials.

  • Contact 811: Call 811 to mark any gas or utility lines on your property. You’ll want to stay 18 to 24 inches away from flags or markings to ensure you don’t accidentally dig into buried lines.

2. Measure and Mark the Spacing

Batter boards measuring fence spacing
Photo: Jim Cox / Adobe Stock

One of the most important steps in building a fence is measuring for an even layout. Take extra care during this part to ensure the fence sits on an even line, the spacing between the posts is accurate, and the corners are squared off. 

  • Lay out the fence design: Using batter boards (temporary frames made from furring strips) and mason line, lay out the perimeter of the fence. Start by identifying the corners and hammer the batter boards into the ground using a rubber mallet, a bit beyond the points of the corner locations. Then, wrap the mason line around the batter board, ensuring the string is at least 6 inches away from the property line. Pull it taut, and run the string parallel to the house, wrapping it around the batter boards as you go. 

  • Square the corners: Squaring the corners ensures the fence is straight while creating a clean-looking appearance. Use the 3-4-5 rule for the most accurate results. Start by measuring 3-feet down the mason line and mark it with marking spray. Then, measure and mark 4-feet down the perpendicular mason line. Measure the distance between the two marks to create a triangle. You’ll know you have a perfectly squared-off corner if the line is 5-feet long. If not, keep adjusting the two points until you get to the 5-foot measurement. 

  • Mark the fence post locations and gate locations: Once the fence line has been completely laid out, hammer stakes into the ground where the posts will go, normally 6-feet to 8-feet apart. Remember to mark the location of any gates as well, which are usually 8-feet wide.

  • Remove the mason line: After the stakes have been placed, use a pencil to mark the location of the mason line on the batter boards and remove the string, so you can begin digging.

3. Dig and Prepare the Post Holes

Digging fence post hole in ground with power auger
Photo: SimplyCreativePhotography / Getty Images
  • Determine the size of the post holes: When digging the holes, be sure to go below the frost line in your region, and ensure they’re three times the width of the posts. If you don’t live in a cold climate, a general guideline is to dig down one-third of the length of the posts. The amount you need to dig can help you decide on the type of tool to use to make the holes.

  • Choose your digging tool: You can choose between a few types of digging tools. A shovel can suffice for shorter fences, or if you have easy soil to work with. A post hole digger is a good option, as this type of tool creates a specific post-sized hole to ensure a tight fit. To speed up the process, you can rent a power auger to create multiple holes of the same height and width, with less effort than using a manual tool. If you decide to rent or purchase a power auger, it’s important to note that you will still need to use manual tools when digging next to the home.

  • Dig the post holes: Dig the holes based on the marked stakes in the ground. If you’re using a power auger, you will likely need the help of a second person. Be sure to let the weight of the auger lower itself into the ground, rather than pushing down on it yourself to create the holes. After each hole has been dug, use a measuring tape to ensure the holes are equal in length. Work along the perimeter of the fence layout until all the holes have been dug.

  • Re-string the mason line: Re-string the mason line along the marked lines on the batter boards to ensure the posts are set straight.

  • Add gravel to the base of the hole (optional): To promote more drainage, consider adding a 2 to 4-inch layer of gravel at the bottom of the hole, packing it down with a tamper. 

4. Position and Set Fence Posts In Concrete

Setting posts in ground for fence installation project
Photo: CatLane / Getty Images

Note: When setting the posts in place, you can keep them level by creating braces from scrap wood. You’ll need two braces per post, so it’s helpful to have these constructed and ready before you start placing the posts. To make the brace, attach a 1-by-2 inch stake to any scrap piece of lumber that is 4-feet in length with a single screw. 

  • Fill the hole with dry concrete mix: Once the holes have been prepared for the posts, start by pouring concrete about 6-inches of the way up the hole with the dry mixture. 

  • Set posts in place: Set the 4-by-4-inch pressure-treated post in the center of the hole, ensuring it’s plumb (perfectly straight in the upright position). You can check this by using a specific post level. 

  • Hold the post in place with braces: Once the post is plumb, hammer in the stake of the brace system to the ground with a rubber mallet. Then, attach the 4-foot end of the bracket drilling a single screw to the post, ensuring it’s still plumb with your post level. 

  • Mix and pour concrete: Mix the concrete per the manufacturer’s directions, and pour it into the hole, guiding in place with a shovel. Keep pouring the concrete into the hole until it is a few inches below ground level. Use a garden hoe to tamp it into place, sloping away from the post. Allow the concrete to cure, referring to the manufacturer for the total setting time (this can sometimes take a few days). 

  • Repeat: Repeat these steps with all the fence posts until complete.

5. Mark and Install Fence Rails

Fence rails installed when building new fence
Photo: CatLane / Getty Images

After the concrete has fully cured, you can follow these steps to learn how to build a fence.

  • Remove braces and batter boards: Once the concrete has cured, you can remove the braces from the posts and the batter boards from the ground.

  • Measure and mark the rail locations: Using a level, measure and mark the location of the rails. This step is especially important if you’re installing the fence on a slope to ensure all the rails are equal in distance. If you’re building a 4-foot fence, one top rail and one bottom rail will suffice. However, taller fences benefit from having a third railing in the middle for additional support. Measure the distance between the top railing and the bottom railing, and divide it in two to place the middle railing. 

  • Measure and cut the rails: Measure the distance between the edge of the two posts, and transfer these measurements to 2-by-3-inch or 2-by-4-inch pressure treated rails. Cut the rails with a circular saw. Remember, you can leave a little room when cutting, then trim the edges using a jigsaw for a flush fit.

  • Attach the rails: Hold up the rail to the outside of the first post, and pre-drill two holes before attaching an exterior deck screw to avoid splitting the wood. Then, using 3-inch exterior screws, drill the rail into place. Repeat the same steps when attaching the rail to the other post, using a level to keep it straight. Use this same process and attach the bottom and middle rails, referring back to the marked lines.

  • Repeat: Follow these same steps around the fence posts until all the rails have been installed.

Note: To save time, you can measure each post with a measuring tape, then affix mason string line to the posts when attaching the rails, rather than using a level each time you install a new railing.

6. Attach Panels or Fence Pickets to the Rails

Attaching wood pickets to new fence with drill
Photo: Gajus / Getty Images

You can choose between using pre-assembled panels or individual fence board pickets to cover the fence rails with. Pre-assembled panels can expedite the process, but they are often more costly than single pickets.

  • Pre-assembled panels: Set up the panel flush with the rails, and simply affix the panel to the outside of the fence using a pneumatic nailer with 1-½-inch nails to speed up the process. Use the top, bottom, and middle rails for reference when determining the mounting points for the nails.  

  • Fence Pickets: Using a level, ensure the first picket is plumb to the rails, then affix it to the outside of the rails using a pneumatic nailer and 1-½-inch nails per board. You can also use a drill and deck screws. Use the top, bottom, and middle rails as mounting points to affix the boards to. If you want to install a wood privacy fence, butt the boards against one another so there isn’t any spacing between the pickets. If you want spaces between the panels, you can use a spacing block between each fence board to ensure equal distance between them. 

Note: If you’re installing the fence on a slope, attach the first picket to the railing, then use a string line between the posts as a reference point for the height of each subsequent board. 

7. Affix Post Caps

Post caps on wood fence posts
Photo: natalyamatveeva / Adobe Stock

Once the panels or fence pickets have been installed, attach post caps to the tops of the posts using a rubber mallet to provide a clean and finished look. You can secure them into place using galvanized steel finishing nails. 

8. Seal and Stain (Or Paint) the Wood

Staining wood fence with paint brush
Photo: encierro / Adobe Stock

After the building portion of the fence installation project is complete, you can make finishing touches to preserve the structure for years to come. 

  • Using an angled paintbrush, apply wood preservative around the base of each post where the structure is most exposed to water to prevent the wood from rotting. If the wood is untreated, you can apply wood preservative to the entire fence area. Otherwise, pressure-treated wood doesn’t need further treatment or water-proofing. 

  • Wait until the wood has fully dried before applying any stain or paint.

  • If you decide to stain or paint the wood, check over the surface for any damage or nicks and sand them down to ensure a smooth finish. If you’re using paint, opt for an exterior oil-based paint. Moreover, it’s important to apply a layer of primer to the fence before painting it to extend the life of the paint and improve coverage when it’s time to apply the topcoat.

  • Use the angled paintbrush to apply primer, stain, or paint to the surface in even coats, working with the grain of the wood.

  • Allow the stain or paint to fully dry, then apply a second coat of paint.

Fence Installation FAQs

What is the best type of wood to use?

When you’re deciding to take on a fence installation project, you’ll notice various types of wood to choose from. Take into consideration your geographic region and your budget when making your selection. Cedar is a popular choice when looking for a budget-friendly option, as it’s resistant to insects and less likely to rot compared to other types. Redwood is another tried-and-true choice because of its durability, but keep in mind that it is more expensive than other types of wood.

When is the best time of year to install a fence?

Fall is a good time to install a new fence, as the ground is still workable for digging holes, and the cool, moist air gives the wood planks time to acclimate to the weather. 

What other types of materials can I use to build a fence?

While wood fencing is versatile and durable, there are other fence material options to consider. Check out our comprehensive list of the Best Types of Fences for Your Home to browse through some other fencing materials, such as aluminum, vinyl, and chain-link.

Need professional help with your project?
Get quotes from top-rated pros.