Article
Projects

How to Build a Privacy Fence: Materials, Height Codes & Step-by-Step Installation

Lumberama Editorial Team, Fence Building & Outdoor Construction Specialists Jun 2, 2025 10 min read
New wood privacy fence with dog-ear pickets and properly spaced posts in a residential backyard

Planning

Check codes and HOA: Most municipalities restrict fence height to 6 feet in back yards and 4 feet in front yards. Many require the "finished" side (flat pickets) to face your neighbor and the structural side (posts and rails) to face your yard. HOAs may restrict fence style, material, and color. Check your local building codes and HOA covenants before buying materials.

Property lines: Know exactly where your property line is. A fence on the wrong side of the line is your neighbor's fence (or a lawsuit). Get a survey if there's any doubt. Many jurisdictions require the fence to be set 1-2" inside the property line.

Utility lines: Call 811 (nationwide utility locating service) at least 3 business days before digging. They'll mark underground gas, electric, water, and cable lines for free. Hitting a gas line while digging a post hole is dangerous and expensive.

Materials

Posts (the most critical component): Use 4x4 pressure treated posts for standard 6-foot fences. For 8-foot fences or high-wind areas, use 6x6 posts. Posts must be ground-contact rated (UC4A or UC4B) — not the standard above-ground treatment. Post length: add 1/3 of the fence height for below-grade depth. For a 6-foot fence, use 8-foot posts (2 feet in the ground).

Rails: 2x4 pressure treated rails. Three rails for a 6-foot fence (top, middle, and bottom). Two rails for a 4-foot fence. Rail spacing: top rail 6-8" from the top of the pickets, bottom rail 6-8" from the bottom, middle rail centered.

Pickets (fence boards): 1x6 or 5/8"x6" dog-ear or flat-top pickets. Cedar pickets for a natural look that weathers to gray. Pressure treated pine for the most affordable and longest-lasting option. Pre-stained pickets are available and save significant labor.

Hardware: Hot-dipped galvanized or stainless steel nails/screws. Never use standard zinc-plated hardware with pressure treated wood — the preservative chemicals corrode cheap fasteners. Ring-shank nails or deck screws hold better than smooth nails.

Post Installation (Get This Right)

Spacing: 6 to 8 feet between posts (center to center). 8 feet is the maximum for 2x4 rails without sagging. 6 feet is stronger and handles wind load better.

Depth: Set posts at least 24" deep (1/3 of total post length) for a 6-foot fence. In cold climates, set posts below the frost line (36-48" in northern states) to prevent frost heave.

Method 1 — Concrete (strongest): Dig a 10-12" diameter hole. Set the post, plumb it, and fill with premixed concrete (one 60-lb bag per post). Crown the concrete above grade so water drains away from the post. This is the standard method for most fence installations.

Method 2 — Gravel/crushed stone (better drainage): Dig the hole, add 4" of gravel at the bottom, set the post, and pack crushed gravel (not pea gravel) around it in 4" lifts, tamping each layer. Better drainage means less rot at the base. Recommended for wet soil conditions.

Method 3 — Driven posts: Metal post drivers or pneumatic post pounders drive sharpened posts directly into the ground. Fastest method but only works in soft soil without rocks. Less secure than concrete.

Construction Steps

Step 1: Set corner and end posts. Install all corner posts, end posts, and gate posts first. Plumb in both directions and brace with temporary diagonal supports until concrete cures (24-48 hours).

Step 2: Run a string line. Stretch a taut string between corner posts at the desired picket top height. This is your reference for straight, level fence lines.

Step 3: Set line posts. Space intermediate posts evenly (6-8 feet). Align to the string line. Plumb and concrete each one.

Step 4: Attach rails. After concrete cures, attach 2x4 rails to the posts with structural screws or galvanized nails. Use a level to keep rails horizontal between posts.

Step 5: Install pickets. Start from one end. Set the first picket plumb (check with a level), then use a spacer for consistent gaps (0" for solid privacy, 1/4" for slight spacing). Attach each picket to all three rails with two fasteners per rail (6 fasteners per picket).

Step 6: Gate construction. Build the gate frame from 2x4s with a diagonal brace running from the bottom hinge side to the top latch side. This brace prevents the gate from sagging. Use heavy-duty gate hardware (strap hinges for wide gates, T-hinges for standard).

Cost Estimate (6-foot fence, per linear foot)

Pressure treated pine: $12-$20/linear foot (materials only). $25-$50/linear foot installed by a contractor.

Cedar: $18-$30/linear foot (materials). $35-$65/linear foot installed.

Total for 150 linear feet (typical backyard): $1,800-$3,000 DIY with PT pine, or $3,750-$7,500 contractor-installed.

Frequently Asked Questions

Lumberama Editorial Team

Fence Building & Outdoor Construction Specialists

Contributor to Lumberama’s reference library. Read our editorial standards and source methodology.

Continue researching fencing

Where readers of this article usually go next.