How to Build a Fence: Planning, Materials, and Cost Estimates
Whether you want privacy from neighbors, a safe enclosure for children or pets, or simply a defined property boundary, building a fence is one of the most practical home improvement projects you can undertake. It is also one where poor planning leads to expensive mistakes, from setting posts on a neighbor's property to discovering a buried gas line the hard way. This comprehensive guide covers every phase of a fence project, from the regulatory homework you need to do before buying a single board to calculating the exact number of posts, rails, and pickets you need for your specific layout.
Pre-Construction Planning: The Steps You Cannot Skip
Verify Your Property Lines
The single most important step before building a fence is knowing exactly where your property ends. Fences built even a few inches over the property line onto a neighbor's land create legal disputes that can require you to tear down the entire fence and rebuild it. Do not rely on assumptions, old landmarks, or "where the last fence was." Hire a licensed surveyor if you do not have a recent survey or if your property corners are not clearly marked with metal pins. A survey costs $300 to $800, which is a fraction of the cost of tearing down and rebuilding a misplaced fence.
Check Setback Requirements
Most municipalities require fences to be set back a certain distance from the property line, sidewalk, or street. Common setback rules include placing fences 2 to 6 inches inside the property line, maintaining a minimum distance from the street or sidewalk (often 10 to 15 feet), and height restrictions that differ between front yards (typically 3 to 4 feet maximum) and back yards (typically 6 feet maximum). These rules vary significantly by jurisdiction. Contact your local building department or zoning office for the specific regulations that apply to your property.
HOA Restrictions
If you live in a neighborhood with a Homeowners Association, your fence options may be limited by the HOA's covenants, conditions, and restrictions (CC&Rs). Common HOA fence rules include approved materials and colors (many HOAs require wood or vinyl and prohibit chain-link), maximum height limits that may be more restrictive than local code, a requirement to submit plans and get approval before starting construction, and the "good neighbor" rule requiring the finished side of the fence to face outward. Violating HOA rules can result in fines and forced removal, so review your CC&Rs carefully and submit any required applications before you begin.
Call 811: Utility Marking
Before you dig a single post hole, call 811 (the national "Call Before You Dig" hotline) at least two to three business days before you plan to start. This free service sends utility companies to mark the location of underground gas lines, water pipes, electrical cables, fiber optic lines, and sewer lines on your property. Hitting a gas line with a post hole digger is not just expensive to repair; it is genuinely dangerous. Utility marking is free, required by law in most states, and takes only a few minutes to request.
Fence Styles: Options, Pros, and Cons
Wood Privacy Fence
The wood privacy fence is the most popular residential fence style in America. It consists of 4x4 posts set in concrete, two or three horizontal 2x4 rails between posts, and vertical 1x6 or 5/8-inch pickets (also called fence boards) attached side by side with no gaps. Standard height is 6 feet, though 8-foot privacy fences are available in areas where codes permit them.
Pros: excellent privacy, blocks wind, reduces noise, wide range of design options (dog-ear, flat-top, lattice-top), can be stained or painted to match your home. Cons: requires regular maintenance (staining or painting every 2 to 3 years), wood will eventually rot and need replacement (15 to 25 year lifespan depending on wood species and maintenance), and it is susceptible to wind damage if not properly braced.
Material cost per linear foot: $15 to $35 depending on wood species. Cedar and redwood cost more than pressure-treated pine but last longer and require less maintenance.
Vinyl (PVC) Privacy Fence
Vinyl fencing has grown in popularity as a low-maintenance alternative to wood. Modern vinyl fences are made from UV-stabilized PVC that resists fading, rotting, and insect damage. They come in white, tan, gray, and wood-grain finishes and mimic the appearance of traditional wood fence styles.
Pros: virtually maintenance-free (occasional cleaning with soap and water), will not rot, warp, or attract insects, long lifespan (20 to 30+ years), consistent appearance over time. Cons: higher upfront cost than wood, limited color options, can crack in extreme cold, difficult to repair (damaged sections usually require full panel replacement), and some people find the appearance less natural than real wood.
Material cost per linear foot: $20 to $40. Installation tends to be faster than wood because vinyl fence systems are prefabricated panels.
Picket Fence
The classic picket fence is a decorative, low fence typically 3 to 4 feet tall. Pickets are spaced 2 to 3 inches apart, allowing visibility through the fence while still defining a boundary. Picket fences are most commonly used in front yards, around gardens, and as decorative borders.
Pros: attractive curb appeal, defines boundaries without blocking views, available in wood, vinyl, and composite materials, relatively affordable. Cons: provides no privacy, does not contain small pets, limited security value, wood versions require the same maintenance as privacy fences.
Material cost per linear foot: $10 to $25 for wood, $15 to $35 for vinyl.
Chain-Link Fence
Chain-link fencing is the most affordable and durable option for large areas. It consists of galvanized steel posts, a top rail, and woven steel mesh (the chain-link fabric). Standard heights are 4, 5, and 6 feet. Privacy slats or fabric can be woven through the mesh to add partial privacy.
Pros: lowest cost per linear foot, extremely durable (30+ year lifespan), minimal maintenance, quick installation, ideal for large perimeters and pet containment. Cons: provides no privacy in standard configuration, utilitarian appearance, not permitted by many HOAs in visible locations, and the metal can become hot to the touch in direct sunlight.
Material cost per linear foot: $7 to $15 for standard galvanized, $10 to $20 for vinyl-coated (black, green, or brown).
Split-Rail Fence
Split-rail fences are rustic boundary fences made from split (not sawn) wooden rails set into notched posts. They are common in rural and semi-rural properties, horse farms, and large lots. Standard configurations use two or three rails with post heights of 3 to 4 feet.
Pros: affordable for large perimeters, natural rustic appearance, easy to install, long-lasting when made from cedar or locust. Cons: no privacy, does not contain small animals without added wire mesh, limited to rural and semi-rural settings aesthetically.
Material cost per linear foot: $8 to $15 for cedar, $5 to $10 for pressure-treated pine.
Calculating Materials: Posts, Rails, and Pickets
Post Calculation
The number of posts you need depends on your total fence length, post spacing, and the number of corners and gates. The standard formula is:
Number of posts = (total fence length / post spacing) + 1 + additional posts for corners and gates
For a standard 8-foot post spacing on a 150-foot fence with two corners and one gate, the calculation is: (150 / 8) + 1 = approximately 20 line posts, plus 2 corner posts and 2 gate posts (one on each side of the gate) = 24 posts total.
Corner posts and gate posts should be set deeper and in larger concrete footings than line posts because they bear more stress. Use 6x6 posts for gates and corners if your fence is 6 feet tall or taller.
Post Depth and Concrete
The rule of thumb is to bury one-third of the total post length. For a 6-foot fence, use 8-foot posts and bury 2 to 2.5 feet. In frost-prone areas, the bottom of the post should extend below the frost line (check your local frost depth, which ranges from 12 inches in the southern US to 48 inches or more in northern states).
Each post hole should be approximately three times the post width in diameter. For a 4x4 post (actual width 3.5 inches), dig a hole 10 to 12 inches in diameter. Each hole requires approximately one 50-pound bag of premixed concrete (or about 0.6 cubic feet). For 24 posts, you would need roughly 24 bags of concrete. Use our concrete calculator to determine the exact amount for your hole dimensions.
Rail Calculation
Most fences use two rails (for fences under 5 feet) or three rails (for 6-foot and taller fences). Rails are typically 2x4 lumber cut to span the distance between posts, or purchased in 8-foot lengths to match 8-foot post spacing. The formula is:
Number of rails = number of fence sections x number of rails per section
For a fence with 19 sections (20 posts) and 3 rails per section: 19 x 3 = 57 rails.
Picket Calculation
For a privacy fence with no gaps between pickets, divide the total fence length by the picket width. Standard fence pickets are 5.5 inches wide (the actual width of a 1x6 board). For 150 linear feet (1,800 inches):
1,800 / 5.5 = approximately 327 pickets
Add 10% for waste, cuts, and defective boards: 327 x 1.10 = approximately 360 pickets.
For a picket fence with gaps, add the picket width plus the gap width and divide the total length by that sum. For 3.5-inch pickets with 2.5-inch gaps: 1,800 / (3.5 + 2.5) = 300 pickets, plus 10% waste = 330 pickets.
Our fence calculator automates all of these calculations for any fence length, style, and post spacing.
Gate Planning and Sizing
Gates are the most failure-prone part of any fence because they are moving parts attached to fixed structures. Proper gate sizing and construction prevents the sagging, dragging, and latching problems that plague many fence gates.
Standard pedestrian gate width is 36 to 42 inches. For equipment access (lawn mowers, wheelbarrows), plan for at least 48 inches. Double gates for vehicle access should be 10 to 12 feet wide. Leave 1/2 inch of clearance on each side of the gate for hardware and seasonal wood expansion.
Gate posts must be stronger than line posts. Use 6x6 posts for gates, set at least 3 feet deep in concrete, with the concrete footing extending to the full depth of the hole. A diagonal brace running from the bottom of the hinge side to the top of the latch side prevents the gate from sagging over time. Use heavy-duty self-closing hinges and a reliable latch mechanism, especially if the gate is for pool enclosure safety (which has its own code requirements).
DIY vs. Contractor: Cost Comparison
Building a fence yourself saves 40% to 60% on labor costs, but it requires tools, physical effort, and time. Here is a realistic cost comparison for a typical 150-linear-foot, 6-foot wood privacy fence:
| Cost Category | DIY | Contractor |
|---|---|---|
| Posts (4x4x8, 24 needed) | $240 - $360 | Included |
| Rails (2x4x8, 57 needed) | $230 - $340 | Included |
| Pickets (1x6x6, 360 needed) | $900 - $1,800 | Included |
| Concrete (24 bags) | $120 - $170 | Included |
| Hardware (screws, brackets, gate hardware) | $100 - $200 | Included |
| Materials subtotal | $1,590 - $2,870 | $1,590 - $2,870 |
| Labor | $0 (your time) | $1,500 - $3,750 |
| Post hole digger rental (if needed) | $50 - $100/day | Included |
| Total | $1,640 - $2,970 | $3,090 - $6,620 |
A typical DIY fence project takes two to four weekends for a moderately experienced homeowner. The most physically demanding part is digging post holes, which can be made much easier by renting a two-person power auger. The most time-consuming part is setting posts plumb and level and waiting for the concrete to cure before attaching rails and pickets.
Consider hiring a contractor if the terrain is significantly sloped (stepped fencing on a slope requires precise calculations), if the fence line crosses utility easements or requires coordination with municipal infrastructure, if the total length exceeds 200 feet (the labor savings of professional crews with power tools becomes significant), or if you need the fence completed quickly for a home sale or compliance deadline.
Installation Tips for a Professional Result
- Set corner and end posts first. Run a string line between them to align all intermediate posts in a perfectly straight line. Even a slight bow in the fence line is visible from a distance and looks unprofessional.
- Use a level on every post. Check plumb in two directions (front-to-back and side-to-side) before the concrete sets. Brace posts with temporary stakes to hold them in position while the concrete cures.
- Let concrete cure fully. Wait at least 24 to 48 hours before attaching rails and pickets. Premature loading can shift posts before the concrete reaches full strength.
- Keep pickets off the ground. Leave a 2-inch gap between the bottom of the pickets and the ground. Wood in direct contact with soil rots quickly, even pressure-treated lumber. This gap also accommodates minor ground variations without requiring you to trim every board.
- Pre-drill near board ends. Driving screws near the end of a picket without pre-drilling splits the wood. A quick pilot hole prevents this and makes the screw easier to drive.
- Use appropriate fasteners. Exterior screws rated for pressure-treated lumber are essential. Interior drywall screws will corrode within a year. Stainless steel or coated deck screws are the best choice for longevity.
- Stain or seal before or immediately after installation. Fresh wood absorbs stain better than weathered wood. Applying stain within two weeks of installation provides the best protection and appearance.
Maintenance and Longevity
A well-maintained wood fence lasts 15 to 25 years. A neglected one may fail in as few as 7 to 10 years. The key maintenance tasks include inspecting annually for loose boards, leaning posts, and signs of rot at the base; re-staining or re-sealing every 2 to 3 years (or as soon as water stops beading on the surface); replacing individual damaged pickets promptly to prevent moisture from reaching the rails; clearing vegetation and debris from the base of the fence to promote air circulation; and checking gate hardware annually and tightening or replacing hinges and latches as needed.
Vinyl fences require much less maintenance but are not maintenance-free. Clean vinyl fencing with soap and water or a pressure washer on a low setting once or twice a year to prevent mold and algae buildup. Inspect for cracks, especially after extreme cold weather. Chain-link fences need occasional inspection for bent or damaged fabric, loose ties, and leaning posts.
Frequently Asked Questions
How deep should fence posts be?
The general rule is to bury one-third of the total post length. For a standard 6-foot privacy fence using 8-foot posts, that means burying 2 to 2.5 feet deep. In areas with frost, posts should extend below the frost line to prevent heaving, which can be 36 to 48 inches deep in northern climates. Setting posts in concrete further improves stability, especially for gate posts and corner posts that bear additional stress from hardware and lateral force.
How far apart should fence posts be?
Standard fence post spacing is 8 feet on center for most wood fence styles, which matches the common rail length of 8 feet. Some fence types use 6-foot spacing for extra strength, particularly in high-wind areas or for fences taller than 6 feet. Chain-link fences typically use 10-foot post spacing. Gate posts should be spaced to match the desired gate width plus approximately 1 inch of clearance for hardware.
What is the best wood for fences?
Cedar and redwood are the most popular choices because they are naturally rot-resistant and insect-resistant without chemical treatment. Pressure-treated pine is the most affordable option and lasts 15 to 20 years with proper maintenance. For premium durability, white oak and black locust are exceptionally rot-resistant hardwoods that can last 25+ years. The best choice depends on your budget, climate, and aesthetic preference. In humid climates, natural rot resistance is especially valuable.
Do I need a permit to build a fence?
In most municipalities, yes, you need a permit for fences above a certain height, typically 6 feet in the backyard and 3 to 4 feet in the front yard. Permit requirements vary by location, so check with your local building department before starting. You may also need to comply with HOA rules, setback requirements, and the good-neighbor provision that requires the finished side to face outward. Building without a permit can result in fines, required modifications, or forced removal.
How much does a fence cost per linear foot?
Costs vary widely by material and style. Wood privacy fences typically cost $15 to $35 per linear foot for materials, or $25 to $60 installed by a contractor. Vinyl fences range from $20 to $40 for materials, $30 to $70 installed. Chain-link is the most affordable at $7 to $15 for materials, $12 to $30 installed. Cedar and composite fencing fall at the higher end. Gate installation adds $150 to $600 per gate depending on size and style. Use our fence calculator to estimate materials and costs for your specific project.