How to Calculate Fence Materials
Fence math has one critical rule most beginners miss: posts have a "fence post problem" — for any fence section, you need one more post than the number of sections, because every section needs a post at each end. A 150 ft fence at 8 ft spacing isn't 18.75 posts; it's 19 sections plus 1 closing post = 20 posts.
Number of posts = sections + 1 (the closing post)
Rails per section = 2 for ≤4 ft fences, 3 for 5-8 ft fences
Concrete bags = posts + (2 × number of gates)
Gate posts = 2 extra posts (one each side) for every gate
Worked example: 150 ft backyard privacy fence
150 ft of 6 ft cedar privacy fence with one gate, 8 ft post spacing:
- Sections: 150 ÷ 8 = 18.75 → 19 sections
- Posts: 19 + 1 = 20 posts (8 ft long, 4x4 pressure-treated)
- Panels: 19 pre-built panels (or pickets equivalent)
- Rails (if not pre-paneled): 19 × 3 = 57 rails (2x4 cedar, ~7 ft 9 in long)
- Gate posts (extra strength): 2 additional posts
- Concrete: 20 posts + 2 (gate doubles) = 22 bags of 50 lb fast-setting
- Material cost estimate: $1,200-1,800 DIY (panels, posts, hardware, gate, concrete)
- Installed by pro: $4,500-7,500 for the same job
Fence Heights and Code Requirements
| Height | Typical use | Post / spacing | Permit usually needed? |
|---|---|---|---|
| 3 ft | Decorative front yard, garden border | 4x4, 8 ft spacing | No |
| 4 ft | Front yard, picket, pool fence (with gate latches) | 4x4, 8 ft spacing | No |
| 5 ft | Mid-height privacy, kid/dog containment | 4x4, 8 ft spacing | Sometimes |
| 6 ft | Backyard privacy — most common | 4x4, 8 ft spacing | Often yes |
| 7 ft | Tall privacy, partial windbreak | 4x4 or 6x6, 8 ft | Yes |
| 8 ft | Max residential, windbreak, deer fence | 6x6, 6-8 ft spacing | Yes — many cities prohibit |
Fence Types and Cost Per Linear Foot 2026
| Type | DIY materials | Installed | Lifespan |
|---|---|---|---|
| Chain link (4 ft) | $8-12/ft | $12-25/ft | 15-25 years |
| Chain link (6 ft) | $12-18/ft | $18-35/ft | 15-25 years |
| Pressure-treated pine (6 ft privacy) | $15-25/ft | $25-45/ft | 15-20 years |
| Cedar (6 ft privacy) | $20-35/ft | $30-50/ft | 20-30 years |
| Redwood (6 ft privacy) | $35-55/ft | $45-75/ft | 25-35 years |
| Vinyl (6 ft privacy) | $25-40/ft | $30-55/ft | 30-50 years |
| Aluminum / steel ornamental | $25-50/ft | $35-65/ft | 30-50 years |
| Wrought iron | $45-80/ft | $60-120/ft | 50+ years |
| Composite (Trex Seclusions) | $30-50/ft | $40-70/ft | 25-30 years |
| Split-rail / ranch (3-rail) | $12-20/ft | $18-30/ft | 10-20 years |
Material Components Explained
Posts
The structure of the fence. 4x4 pressure-treated for residential 4-6 ft fences; 6x6 for tall or windy sites. Use ground-contact rated lumber (UC4A or UC4B stamp). Length = fence height + 2 ft minimum for burial. End posts and gate posts always go in concrete; line posts can be concrete or tamped gravel depending on soil and code.
Panels vs pickets
Pre-built panels (8 ft sections, 2-3 rails attached, pickets pre-nailed) are much faster to install but limit your design options. Custom picket fence built on site uses individual pickets nailed to horizontal rails — more work but lets you match unusual heights or curves. Most modern DIY projects use panels.
Rails
Horizontal members between posts that pickets attach to. 2x4 lumber is standard; 2x6 for tall or privacy fences. Two rails for fences 4 ft and under, three for 5-8 ft fences. Cut to fit between posts — typically 7 ft 9 in for 8 ft post spacing.
Gates
Standard residential gate widths: 3 ft (walk-through), 4 ft (wide walk-through), 5-6 ft (mower access), 10-12 ft (double gates for vehicles). Gates use double posts (4x4 alongside each gate side or single 6x6) with extra concrete depth. Gate hardware costs $30-100 for residential walk- through gate, $100-250 for double-leaf vehicle gates.
How to Build a Fence: Step by Step
- Verify property lines. Survey or accurate plat map. Check setback requirements (often 6-12 inches off property line) and HOA / city rules.
- Call 811. Three business days minimum before digging. Mark planned post holes with marking paint.
- Pull permits if required. Most cities require permits for fences over 6 ft. Some require them for any fence.
- Set the corner and end posts first. These define the fence line. Use string lines between them to align line posts.
- Dig post holes. Posthole digger or rented power auger ($75-100/day). Depth = 1/3 of total post length OR below frost line, whichever is deeper. 10-12 inch diameter holes.
- Set posts plumb in concrete. 4-6 inches of gravel at bottom for drainage. Position post, level both directions, pour dry-mix fast-set concrete into hole, add water per bag instructions. Brace and let cure 30-60 minutes before stress.
- String line at top of posts. Cut posts to even height (or set lower posts higher in their holes initially). Most fences look better with posts cut to consistent height after concrete sets.
- Attach rails. 3 inches from top of pickets, 8 inches from bottom, even middle rail for 5+ ft fences. Use galvanized or stainless screws — galvanized nails work but loosen over years.
- Install pickets or panels. Panels: lift into place, screw to posts. Pickets: pre-measure and pre-nail to make spacing consistent. Use a spacer block for uniform gaps.
- Hang gates. Heavy-duty gate hinges (3+ per gate side), gate latch, gate stops. Plumb the gate carefully — a gate that drags is a constant annoyance.
- Stain or seal within 30 days. Fresh pressure-treated lumber should weather 1-3 months before staining, but cedar should be stained promptly. Stain extends fence life 30-50%.
Slopes: Stepped vs Racked Fencing
Sloped ground creates a design choice that affects materials and look:
Stepped fence
Each section steps up or down from its neighbor. Posts stay vertical, panels stay rectangular. Used with pre-built panels. Creates triangular gaps under low end of each panel — typical fix is kickboards or letting the panel touch grade. Simpler but less elegant.
Racked fence
Each section is parallelogram-shaped, following the slope angle. Posts stay vertical; pickets stay vertical; rails angle with the ground. Looks much better on slopes but requires either custom construction or racked-panel kits. Manufacturer racks are often only $10-20 more per panel.
Contoured fence
Pickets angle with the slope; rails also angle. Old-school approach, most labor-intensive. Looks beautiful on gentle slopes; impractical on steep ones. Rare in modern DIY work.
Fence Lifespan and Maintenance
- Stain every 2-3 years. Most important maintenance. Doubles fence life.
- Reset loose posts immediately. A leaning post stresses neighboring sections — small repairs prevent cascading failure.
- Trim vegetation away. Vines and brush trap moisture against wood. Climbing plants destroy fences faster than weather.
- Replace damaged pickets promptly. One missing picket lets neighborhood kids and animals through and tempts further damage.
- Check gate alignment annually. Adjust hinges and stops as posts settle. Gates that drag are the #1 source of broken hinges.
- Inspect ground line. Posts fail at the soil line first. Use post brackets to elevate replacement posts above the soil.
Common Fence Mistakes
- Not calling 811: Striking a gas or electric line is dangerous and expensive. Free service, 5 minutes to request.
- Posts too shallow: 1/3 of post height minimum. Tall fences in windy areas need 36-48 inches deep.
- Wood posts below grade without ground-contact rating: Untreated or above-ground rated lumber rots within 3-5 years. Always UC4A or UC4B stamp.
- Concrete crown not sloped: Water pools around post, accelerates rot. Slope concrete away from post.
- Forgetting gate-post doubling: Gates put massive lateral load on their posts. Singles bend; doubles last.
- Building right on property line without agreement: Without written neighbor agreement, you may be required to move it.
- Setting fence too tight to neighboring features: Leave 6-12 inches between fence and structures for maintenance access.
- Skipping the kickboard: A horizontal board at the bottom hides ground irregularities and keeps animals from digging under. Worth the extra $1/ft.