Calculator
ft
gates
$/panel
Fence materials
20 posts 19 panels (or equivalent)
Rails: 57  ·  Concrete: 20 bags (50 lb)  ·  Gate posts: 2
Estimated panel cost: $1,235 plus posts, rails, hardware, gates, concrete

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 sections = Fence length ÷ post spacing (round up)
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
Call 811 before you dig
Three business days before digging post holes, call 811 (or use the online tool). Utilities mark their underground lines for free. Hitting a gas line is a 911 event; hitting a fiber line costs $500-2,000 in repair fees. It's mandatory in most US states and takes 5 minutes to request.

Fence Heights and Code Requirements

Height Typical use Post / spacing Permit usually needed?
3 ftDecorative front yard, garden border4x4, 8 ft spacingNo
4 ftFront yard, picket, pool fence (with gate latches)4x4, 8 ft spacingNo
5 ftMid-height privacy, kid/dog containment4x4, 8 ft spacingSometimes
6 ftBackyard privacy — most common4x4, 8 ft spacingOften yes
7 ftTall privacy, partial windbreak4x4 or 6x6, 8 ftYes
8 ftMax residential, windbreak, deer fence6x6, 6-8 ft spacingYes — 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/ft15-25 years
Chain link (6 ft)$12-18/ft$18-35/ft15-25 years
Pressure-treated pine (6 ft privacy)$15-25/ft$25-45/ft15-20 years
Cedar (6 ft privacy)$20-35/ft$30-50/ft20-30 years
Redwood (6 ft privacy)$35-55/ft$45-75/ft25-35 years
Vinyl (6 ft privacy)$25-40/ft$30-55/ft30-50 years
Aluminum / steel ornamental$25-50/ft$35-65/ft30-50 years
Wrought iron$45-80/ft$60-120/ft50+ years
Composite (Trex Seclusions)$30-50/ft$40-70/ft25-30 years
Split-rail / ranch (3-rail)$12-20/ft$18-30/ft10-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

  1. Verify property lines. Survey or accurate plat map. Check setback requirements (often 6-12 inches off property line) and HOA / city rules.
  2. Call 811. Three business days minimum before digging. Mark planned post holes with marking paint.
  3. Pull permits if required. Most cities require permits for fences over 6 ft. Some require them for any fence.
  4. Set the corner and end posts first. These define the fence line. Use string lines between them to align line posts.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. 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.
  11. 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.

Frequently Asked Questions

How many fence posts do I need?

Divide fence length by post spacing (typically 8 feet), then add 1 for the end post. For 150 ft of fence at 8 ft spacing: 150 ÷ 8 = 18.75, rounded up to 19 panels + 1 end post = 20 posts. Add 2 posts for each gate (gate posts are doubled for strength).

How far apart should fence posts be?

8 feet on center is standard for residential wood and vinyl fencing — matches pre-built 8 ft panels and standard rail lengths. Chain link can space posts 10 ft apart since the fabric is the structure. Ranch and split-rail fences typically use 10 ft spacing for rustic look. Reduce to 6 ft on slopes or windy sites.

How deep should fence posts be buried?

Minimum 1/3 of the post height below grade, or below the local frost line, whichever is deeper. A 6 ft fence with 8 ft posts means 2 ft underground minimum. In northern US frost zones (24-48 inch deep frost): bury posts 36-48 inches deep regardless of post height. Always use 4x4 pressure-treated posts or 6x6 for tall fences.

How much concrete do I need per fence post?

One 50 lb bag of fast-setting concrete (1/2 cu ft mixed) is enough for a typical 6 ft fence post hole (10 inch diameter × 24 inch deep). For 8 ft posts buried 36 inches deep in 12 inch holes: 2 bags. Gate posts always get 2 bags for extra holding strength. Use Quikrete Fast-Setting or Sakrete equivalent.

How much does a wood fence cost per linear foot?

DIY material: $15-30 per linear ft for typical 6 ft cedar or pine privacy fence. Professional install: $25-50 per linear ft. For 150 ft: $2,250-4,500 DIY, $3,750-7,500 installed. Chain link is cheapest ($12-25/ft installed); vinyl is mid-range ($25-40/ft); aluminum and ornamental iron $30-60/ft+.

What size lumber for fence posts?

4 by 4 inch pressure-treated for 4-6 ft residential fences. 6 by 6 inch for 7-8 ft tall fences or windy sites. 4 by 4 cedar or redwood for decorative fences (no ground contact rating needed). Use posts 2 feet longer than fence height — 8 ft posts for a 6 ft fence (2 ft buried).

How long should fence rails be?

Cut rails to fit between posts — typically 7 ft 9 in for 8 ft post spacing (8 ft total minus post width). For pre-built panel fences, rails come pre-attached. Three rails for 5-8 ft fences (top, middle, bottom). Two rails for 4 ft and shorter fences. Use 2 by 4 lumber for residential, 2 by 6 for tall or heavy fences.

Do I need a permit to build a fence?

Usually yes for fences over 6-7 feet tall, and often for any fence in front yard or on property line. Permits required in most cities. Check local zoning before buying materials. Also call 811 (Call Before You Dig) at least 3 days before digging post holes — they mark utility lines for free, and hitting one is dangerous and expensive.

What's the cheapest fence material?

Chain link is the cheapest at $12-25/ft installed for residential 4-6 ft fence. Pressure-treated wood pickets next at $15-25/ft DIY. Hog wire / cattle panel fencing $5-12/ft for rural / large lots. Vinyl is more expensive upfront ($25-40/ft) but lasts 30+ years without maintenance, often cheaper over time.

How long does a wood fence last?

Pressure-treated pine: 15-20 years with staining. Cedar: 20-30 years, naturally rot-resistant. Redwood: 25-35 years (expensive). Untreated lumber: 5-7 years. Add 30-50% lifespan with annual stain or seal. Posts always fail first (at ground line) — use metal post brackets to elevate wood off the ground for 2x lifespan.

Can I put a fence right on the property line?

Usually no — most jurisdictions require 6-12 inches setback from property line. Check local code. Many neighbors agree to put the fence directly on the line and share cost; this can be more efficient but creates issues if you ever want to move it. Get any shared-fence agreement in writing. A surveyor ($300-700) eliminates property-line disputes.

What's the difference between privacy fence and panel fence?

Privacy fence is any fence that fully blocks sightlines — typically 6 ft+ tall with no gaps between pickets. Panel fence refers to pre-built 8 ft sections (any height, any style). Most modern privacy fences ARE panel fences — pre-built solid panels delivered ready to install. Custom-build picket fence is the alternative.