Fence Calculator: Cost, Fencing Materials, and Dimensions

US FlagCASAPLORERTrusted & Transparent


Fence Sections20
Rail Length8 ft

Fence Posts

Number of Posts21
Minimum Required Height of Posts9 ft
Minimum Required Depth of Post Holes3 ft

Estimated Cost

Pressure Treated Wood$1,019.00 - $3,656.00
Cedar$1,169.00 - $6,268.50
Redwood$2,123.50 - $9,390.00
Vinyl$710.00 - $2,160.00
Chain-Link$160.00 - $3,680.00
Aluminum/Metal$2,560.00 - $14,400.00
Simulated Stone (SimTek Fence)$11,200.00 - $14,400.00

About This Fence Calculator

This fence calculator will find the fence cost, dimensions, and required fencing materials for your fencing project. It also estimates the number of fence sections, pickets, nails, rails, and posts required, while providing recommended minimum height of fence posts and minimum depth of post holes.

How to Estimate Your Fencing Project

To use this fence calculator, you will need to enter information about your fencing project.

  1. Fence Length

    The first thing you will need to figure out is the total length of your fencing. If you’re looking to build a perimeter fence or privacy fence for your home, it will most likely have corners.

    To measure the total length of your fence, use wooden stakes to mark out where the corners will be. Measure the length of each section, and then add them up to get the total length of your fence. It can be difficult to use a laser measuring device outside for longer distances, which is why an old-fashioned tape measure can be used. Measuring tapes can be 100 ft, 200 ft, or even longer.

    According to HomeAdvisor, backyards generally have a perimeter of 150 ft to 170 ft. The default value that this fence calculator uses is 160 feet for the total length of the fence. This number can be changed to the total fence length that applies for your project.

    Some companies may quote or give you a cost estimate based on a price per square foot or acre. Once you know the area that you want to fence, you can use a square footage calculator to find out the square footage coverage. This is more common for large areas, such as fields and farmland.

  2. Fence Height

    The height of a fence generally depends on the purpose of the fence.

    If a fence is for privacy and to prevent others from looking in, the height of the fence will need to be higher than eye-level. Privacy fences generally have a height of 6 feet, but they can go up to 8 feet high or taller.

    Decorate fences, also called ornamental fences, are generally shorter. They are commonly around 3 feet to 4 feet.

    Pool fences are used as a safety barrier to prevent young children from entering a swimming pool without adult supervision. The U.S. Consumer Product Safety Commission (CPSC), a federal government agency, recommends that pool fences be at least 4 feet high. A pool calculator can be used to estimate the cost of a pool fence and tarp cover.

    While the CPSC recommends a fence height of 4 feet, some states and counties have added pool fences to their building codes making it a legal requirement. For example, California requires pool fences for residential pools. California also requires pool fences to be at least 5 feet tall.

    Some counties and municipalities can have additional regulations even if the state does not require pool fences. For example, Colorado does not require pool fences for residential pools, but Denver County requires pool fences that are at least 5 feet tall.

  3. Fence Post Spacing

    Fence post spacing is how far apart each fence post will be from each other. Having fence posts too far apart from each other can weaken the fence. Having fence posts too close together can increase the cost of the fence, as fence posts and caps add additional expenses.

    Wooden fence posts are usually 6 feet to 8 feet apart from each other. Farm fences, such as field fences or fencing for cattle, may have post spacing of 8 feet to 12 feet.

  4. Fence Post Hole
  5. Fence Post Width

    The most common square fence post width is 4 inches by 4 inches. Fence posts can also be 6 inches by 6 inches or any other size, and can be circular or round.

  6. Fence Post Hole Depth

    Fence posts should be deep enough in the ground so that the fence is stable. The fence post hole should also be deeper than the frost line. It's recommended that the post hole depth be at least half of the fence height. This means that a third of the post will be in the ground, and the other two-thirds would be above-ground. Gravel can be added to the base of the post hole to allow for drainage and to prevent damage to the wooden fence. Use a gravel calculator to find out how much gravel would be needed.

    Posts can be set in concrete for further stability. A concrete calculator can be used to estimate the cost and concrete needed.

  7. Wooden fence post in hole with concrete
  8. Rails

    Rails are the horizontal pieces that connect together the fence posts and are the pieces that the fence pickets are attached to. A good rule of thumb is to have one rail for every 2 feet of fence height. For a decorative fence with a height of 3 feet, you will need two rails. A privacy fence of 6 feet will require three rails.

    Rails can also either be face-nailed or toe-nailed. Face-nailed rails are rails that are nailed to the face of the posts. If they are nailed to the side of the posts, then they are called toe-nailed rails. Face-nailed rails will need to be longer than toe-nailed rails.

  9. Pickets

    Pickets are the vertical boards that are attached to the rails. Fence posts and rails make up the support structure of a fence, while the pickets are the main body of the fence. Pickets usually have a width of 3.5 inches to 6 inches.

    If you’re looking to build a privacy fence, the pickets will need to be close enough together so that you can’t see through. This means that gaps between pickets would be ¼” or less. You may even create a solid fence board with no gaps between pickets.

    Wood can expand and shrink, which may cause warping or gaps to form. A shadow box fence, sometimes called a good neighbor fence, has staggered pickets on both sides that slightly overlap each other. This allows air to pass through the fence while preventing your neighbor from looking in. Shadowbox fences also look the same on both sides. This means that you won't have one side where the fence rails are exposed. However, shadowbox fences require more pickets, which can make them more expensive.

Fencing Calculations

Fence Post Calculations

To calculate the number of posts needed, the formula is:

This gives you the number of posts needed to cover a certain distance based on the posts being a certain distance apart from each other. You will need to round up to the nearest whole number.

The formula for the depth of the post hole is:

Minimum Required Depth of Post Holes = Fence Height x 0.5

At least a third of the post needs to be in the ground for a stable fence.

Along the same lines, this formula gives us the height of the post hole given a certain fence height:

Minimum Required Height of Posts = Fence Height x 1.5

Fencing Calculations

The number of fence sections would be the number of posts - 1. Fence sections are the sections in-between each post.

Number of Fence Sections = Number of Posts - 1

To calculate the total number of pickets, you will need to know your fence length, picket width, and picket spacing. The most common width for pickets is 3 ½ in. Fence pickets are commonly measured in inches, so you will need to convert your fence length into inches when calculating. This can be done by using a unit converter to convert feet into inches.

Each rail is attached to fence posts using two nails on each end. Each picket should also be attached to each fence rail using two nails. You can also use screws for wooden fences. Nails are faster to install, while screws are stronger. To calculate the number of nails or screws needed, the formula is:

Number of Nails = (Number of Rails x 4) + (Number of Pickets x Number of Rails x 2)

The total number of rails needed depends on the number of rails per section and the number of fence sections. The formula is:

Number of Rails = (Number of Rails per Section) x (Number of Fence Sections)

The length of each rail depends on if the rail will be face-nailed or toe-nailed. You will need less length for toe-nailed rails, as the rails will end at each fence post. Face-nailed rails do not end at each fence post, which requires them to be longer.

Rail Length (Face-Nailed) = Post Spacing

Example Fencing Project

Let’s say that you want to build a privacy fence along the perimeter of your backyard and you would like to estimate the materials required and the cost of the fence. You need 160 feet of fencing and you want the fence to be 6-feet high and have posts 6 feet away from each other. Here’s a step-by-step guide through the calculations.

How many fence posts do I need?

Number of Posts = 28

You will need 28 fence posts. While the calculation gives an answer of 27.66, you will need to round up to the nearest whole number. That’s because you can’t have a fraction of a fence post. Rounding down will mean that the entire fence length wouldn’t be covered.

How tall and deep should the fence posts be?

Minimum Required Height of Posts = Fence Height x 1.5

Minimum Required Height of Posts = 6 ft x 1.5

Minimum Required Height of Posts = 9 ft

Since you want the fence height to be 6 feet, you will need a post that is at least 9 feet. Similarly, the minimum depth of the post hole would be 3 feet. This gives you a fence height of 6 feet above the ground.

Minimum Required Depth of Post Holes = Fence Height x 0.5

Minimum Required Depth of Post Holes = 6 ft x 0.5

Minimum Required Depth of Post Holes = 3 ft

How many pickets do I need?

Let’s say that the pickets are 3.5 inches wide with no gaps between them. The fence length of 160 feet will be converted to inches, which is 1,920 inches.

Number of Pickets = 549

You will need 549 pickets.

What if you want to build a shadowbox fence instead? Since the pickets will be overlapping each other, the picket spacing will be negative. Let’s say that there is a 1 inch overlap between each staggered picket.

Number of Pickets = 768

A shadowbox fence with 1” overlap would require 768 pickets. That’s about 40% more pickets required than a fence with no overlap and no gaps.

How many nails do I need?

Number of Nails = (Number of Rails x 4) + (Number of Pickets x Number of Rails x 2)

Number of Nails = (3 x 4) + (549 x 3 x 2)

Since the privacy fence height is 6’, you will need three rails. Based on 549 pickets, you will need 3,306 nails or screws.

A 6-penny nail, also called a 6d nail, is 2 inches long. A 16-penny nail (16d nail) is 3.5 inches long. 16d nails are commonly used for fences. A 1 lb. box contains about 63 pieces of 16d nails.

How many rails do I need?

Number of Fence Sections = Number of Posts - 1

Number of Fence Sections = 28 - 1

Number of Fence Sections = 27

Number of Rails = (Number of Rails per Section) x (Number of Fence Sections)

Number of Rails = (3) x (27)

Number of Rails = 81

For 27 fence sections, you will need 81 rails.

How long is each fence rail?

Rail Length (Face-Nailed) = Post Spacing

For face-nailed rails, each fence rail length would be the post spacing. This means that a face-nailed rail would have a length of 6 feet in our example.

For toe-nailed rails, we will need to convert it to the same unit. Let’s say that the post width is 4 inches.

Rail Length (Toe-Nailed) = 70”

A toe-nailed rail would need to be 70 inches long. That’s two inches shorter than the 72 inches length of a face-nailed rail.

Fence Materials

Pressure Treated Wood

Pressure-Treated Wood

Pressure-treated wood is among the cheaper fence materials to use. It has been treated against moisture which allows it to last longer than untreated wood. A 6-foot section of pressure-treated wood fencing would cost from $44 to $155.


Cedar Fence

Untreated cedar can last as long as pressure-treated wood, and it can be treated to last even longer. Cedar is a cheaper fence material to use when compared to the cost of redwood fences, but it is more expensive than pressure-treated wood. A 6-foot section of cedar fencing would cost from $51 to $268.


Redwood Fence

Redwood is a strong and durable fence material that comes at a premium. A 6-foot section of cedar fencing would cost from $96 to $400.


Vinyl Fence

Vinyl fences require little maintenance and are a good alternative to wood as a material for your fence. Since vinyl doesn’t warp or shrink, it will continue looking just like new. A 6-foot section of vinyl fencing would cost from $36 to $108.

Metal Fencing

Types of metal fencing include chain-link, aluminum, wrought iron, and steel fencing. Metal fences are commonly used for perimeter fences where sturdiness and rigidity is needed for security. They can be anti-climb, such as in the case of steel palisade fences. However, they can also be used for decorative purposes, such as with aluminum fences.

Chain Link Fence


Metal chain link fences are used as a physical barrier rather than as a privacy fence. Chain link fences are cheaper than some wood fences, but it might not add as much value to your home as other fence material types. To calculate the cost of a chain-link fence, this calculator estimates that a 6-foot section of chain-link fencing would cost from $66 to $138.

Aluminum Fence


Aluminum fences are usually used as decorative fences or ornamental fences. They are more expensive than wood fences, but they are durable and won't rust unlike some chain link fences. Hedges can also be planted along the base to create privacy. A 6-foot section of aluminum fencing would cost from $84 to $540.

Simulated Stone Fence

Simulated Stone (SimTek)

Simulated stone, also called SimTek fencing, is molded composite plastic that makes it look similar to stone. A 6-foot section of SimTek fencing would cost from $420 to $540.

Any calculators or content on this page is provided for general information purposes only. Casaplorer does not guarantee the accuracy of information shown and is not responsible for any consequences of its use.