Fence Calculator

Calculate posts, pickets, and rails for wood privacy, wood picket, or chain link fencing — with a full material cost estimate.

Pick your fence type, enter your total length and height, and this calculator works out exactly how many posts, pickets (or mesh rolls), and rails you need — plus a full material cost estimate including gates.

Select fence type 3 fence types
ft
Perimeter or total linear length
Each gate needs 2 extra posts
Material pricing (optional)
$
4×4×8 pressure-treated: $10–$15
$
1×6×6 cedar: $2–$4
$
2×4×8 PT: $6–$10
$
Pre-hung wood gate: $60–$150

How fence materials are calculated

Every fence, regardless of style, starts from the same basic post-counting logic — divide the total fence length by the spacing between posts, then add posts for the ends, corners, and any gates. From there, the specific picket, rail, or mesh calculation depends on the fence type.

Post count Sections = ceil(Fence length ÷ Post spacing) Line posts = Sections − 1, plus 2 end posts, plus 2 posts per gate

Worked example — 150 ft fence, 8 ft post spacing, 1 gate:

  1. Sections: ceil(150 ÷ 8) = 19 sections
  2. Line posts: 19 − 1 = 18 posts
  3. End posts: 2 posts (start and end of the run)
  4. Gate posts: 1 gate × 2 = 2 posts
  5. Total posts: 18 + 2 + 2 = 22 posts

For a wood fence, each section then needs its own picket count based on how wide the pickets are and how much gap sits between them:

Pickets per section (wood fence) Pickets per section = ceil[(Post spacing in inches) ÷ (Picket width + Gap width)]

Continuing the example — 8 ft (96 in) spacing, 5.5 in pickets, 1.5 in gap:

Pickets per section: ceil(96 ÷ (5.5 + 1.5)) = ceil(96 ÷ 7) ≈ 14 pickets per section. Across 19 sections: 14 × 19 = 266 pickets total.

Post depth and the frost line

Post burial depth Burial depth ≈ Fence height ÷ 2 (approximates burying 1/3 of a properly-sized total post length)

This comes from a simple relationship: if a post is sized so that exactly the fence height remains above ground, and the standard rule is to bury roughly one-third of the total post length, then the total post length works out to about 1.5× the fence height, and the buried portion is one-third of that — which simplifies to burying half the fence’s height. For a 6 ft fence, that means roughly 3 ft of burial depth (using a 9 ft post — 6 ft exposed, 3 ft buried, and 3 is exactly one-third of 9).

This calculator adds another 6 inches to the burial depth as a base for gravel — improving drainage at the bottom of the hole and reducing direct wood-to-soil contact, both of which meaningfully extend post life against rot.

Frost line matters as much as this rule of thumb. In any climate with a real winter freeze, local code typically requires post holes to extend below the frost depth regardless of what the height-based burial formula suggests — frost heave can lift a post that isn’t set deep enough, even if the “bury half the height” guideline was followed. Frost depth ranges from essentially 0 inches in the Deep South to 60+ inches in the northern US and Canada; check your local building code for the exact requirement in your area, and use whichever depth is greater between the frost-line requirement and the height-based rule of thumb.

Choosing a fence type

Fence typeTypical costPrivacyMaintenanceLifespan
Wood privacy$15–$35/linear ftHigh (solid boards)Stain/seal every 2–3 years15–20 years
Wood picket$12–$28/linear ftLow (open spacing)Stain/seal every 2–3 years15–20 years
Chain link$8–$18/linear ftNone (see-through)Minimal20–30 years

Wood privacy fences use closely-spaced or gapless pickets and are the standard choice when full visual screening is the goal — backyard privacy, pool enclosures, or separating a property from a busy street. They require periodic staining or sealing to resist weathering and generally need replacement or significant repair within 15–20 years depending on climate and wood species.

Wood picket fences use wider gaps between pickets — sometimes equal to the picket width itself for a fully “open” look — trading privacy for a more decorative, traditional appearance. They’re common for front yards and situations where a visual boundary matters more than screening.

Chain link fences are the most economical and lowest-maintenance option, with the longest typical lifespan since galvanized steel doesn’t need staining or sealing the way wood does. The tradeoff is zero privacy and a less decorative appearance, though privacy slats can be added to a chain link fence after installation as a lower-cost alternative to a full wood privacy fence.

Wood species also affects both cost and lifespan within either wood fence type. Pressure-treated pine is the most economical and widely available choice, chemically treated to resist rot and insects, and is a reasonable 15–20 year investment for most residential applications. Cedar and redwood cost more upfront but have natural rot and insect resistance without chemical treatment, age to an attractive silver-gray patina if left unfinished, and are often preferred for their appearance and lower environmental-treatment footprint. Composite and vinyl fencing (not covered by this calculator’s picket-based math, since they use different panel-based systems) offer the lowest maintenance of any fence material but at a meaningfully higher upfront cost than wood.

Picket spacing and gaps

Gap widthLookPrivacy level
0 inSolid, no visible gapsMaximum privacy
1/2 inNear-solid, minimal shadow linesVery high
1.5 inStandard, subtle shadow-box effectHigh
3 inSemi-open, visible gapsModerate
Equal to picket widthFully open picket styleMinimal (decorative only)

A small gap (1/2 to 1.5 inches) is a common middle-ground choice even for a “privacy” fence — it provides meaningful airflow through the fence, which reduces wind load on the structure during storms and helps the wood dry out after rain, both of which extend the fence’s practical lifespan compared to a completely solid, gap-free design. Fully solid (0-inch gap) fencing maximizes privacy and sound dampening but experiences more wind load and slower drying, which can accelerate warping or rot in wetter climates.

The picket-per-section formula above also means that changing post spacing changes the picket count even when the total fence length stays the same — tighter post spacing (say, 6 ft instead of 8 ft) means more, shorter sections, which slightly increases total picket count due to additional rounding at each section boundary. This is a minor effect for most projects but worth knowing if a material estimate seems to shift slightly when experimenting with different post spacing options for the same overall fence length.

Gates and corners

Every gate in a fence run needs two additional posts beyond what the straight-line post count would otherwise require — one on each side of the gate opening, since the gate itself needs solid anchor points independent of the regular line-post spacing. This calculator adds these automatically based on how many gates you specify.

Corners work differently depending on the property’s actual layout. A simple rectangular yard has four 90-degree corners, and this calculator’s straight-run formula (2 end posts for the overall perimeter) doesn’t automatically add extra posts at interior corners — for an L-shaped or multi-sided fence line, it’s worth manually confirming that each corner gets its own post, since a corner post typically needs to be slightly more robust (often a larger post size) than a standard line post, given it resists lateral force from two directions rather than one.

Property line verification is worth doing before any post goes in the ground, independent of the material calculation itself. Many residential disputes and costly do-overs trace back to a fence installed slightly over a property line, sometimes discovered only when a neighbor’s own survey or a home sale title search reveals the discrepancy years later. A licensed survey, or at minimum careful reference to an existing plat map and any visible property pins, is worth the modest upfront cost or effort compared to the alternative of a legal dispute or forced fence relocation after the fact. Many municipalities also require a permit for fences above a certain height, and some have setback requirements from the property line itself — both worth confirming with local code before finalizing a fence layout.

Real-world applications

A standard backyard privacy fence, roughly 150 linear feet enclosing a typical suburban lot with one gate, needs about 22 posts and 250–300 pickets (depending on exact spacing and gap choice) — a project commonly running $3,000–$6,000 in materials alone for pressure-treated wood, more for cedar or higher-grade lumber.

A front yard picket fence, often shorter (50–80 linear feet) and lower (3–4 ft) than a backyard privacy fence, needs proportionally fewer materials but still benefits from the same post-spacing and gate-post logic — a good example of how this calculator scales down cleanly for smaller decorative fencing projects.

A large property perimeter in chain link — sometimes several hundred to over a thousand linear feet — is where chain link’s material and labor economy compared to wood becomes most apparent, since the roll-based mesh material and simpler line-post installation scale more efficiently over long, straight runs than individually placed wood pickets and rails.

A pool enclosure fence frequently has specific code-mandated requirements beyond general residential fencing rules — many jurisdictions require a minimum height (often 4 feet, sometimes higher), self-closing and self-latching gates, and maximum gap or opening sizes specifically designed to prevent young children from climbing through or over the fence. These pool-safety code requirements typically apply on top of, not instead of, standard fence permitting — worth researching specifically before finalizing a pool fence design, since general residential fence guidance doesn’t automatically satisfy pool-specific safety code.

Common mistakes to avoid

  • Ignoring frost depth in cold climates. The height-based burial rule of thumb is a reasonable starting point, but frost line requirements can call for a deeper hole regardless — check local code before finalizing post depth.
  • Forgetting extra posts for gates. Each gate needs 2 dedicated posts beyond the regular line-post spacing — leaving these out of a material order is a common and easily avoidable shortfall.
  • Not reinforcing corner posts. A corner post resists force from two directions and often warrants a larger post size than a straight-run line post — treating every post as identical can leave corners under-built.
  • Choosing zero-gap solid fencing without considering wind load. A completely solid fence acts like a sail in high wind — a small gap (even 1/2 inch) meaningfully reduces wind load while barely affecting visual privacy.
  • Underestimating concrete for post holes. Roughly 2 bags of concrete per post hole is a reasonable planning figure for standard residential post sizes — skipping concrete or using too little risks a post that shifts or leans over time.
  • Assuming all fence types use the same cost-per-foot. Wood privacy, wood picket, and chain link have meaningfully different material costs per linear foot — always price out your specific chosen type rather than assuming a rough fencing budget applies universally across styles.
  • Skipping a property line check before installation. A fence installed even slightly over a property line can create a genuine legal dispute and a costly relocation — confirm boundaries before digging any post holes, not after.
  • Overlooking pool-specific fence code if applicable. Standard residential fence guidance doesn’t automatically satisfy pool-safety requirements around height, gate self-closing mechanisms, and gap sizing — check local pool fence code separately if your project encloses a pool.
Frequently asked questions
How many fence posts do I need?
Divide your total fence length by the post spacing, then add 1 for the final end post — for an 8 ft post spacing on a 100 ft fence: 100 ÷ 8 = 12.5, round up to 13, plus 1 = 14 posts for a straight run. Add 2 posts per gate. This calculator handles all of that automatically, including proper section-based rounding.
How deep should fence posts be set?
A reasonable rule of thumb is burying about half the fence height (which approximates burying one-third of a properly-sized total post). For a 6 ft fence, that's roughly 3 ft deep, plus 6 inches for a gravel base. In freezing climates, dig below the local frost line regardless — frost depth ranges from about 12 inches in the South to 60+ inches in northern states. Check local code for your specific area.
How many pickets do I need for a wood fence?
Pickets per section = ceil(post spacing in inches ÷ (picket width + gap width)). For 8 ft (96 in) spacing with 5.5 in pickets and a 1.5 in gap: 96 ÷ 7 ≈ 14 pickets per section. Multiply by your total number of sections for the full fence. This calculator computes this automatically based on your chosen picket size and spacing.
How much does it cost to build a fence?
Wood privacy fencing runs $15-$35 per linear foot installed; wood picket runs $12-$28; chain link is the most economical at $8-$18 per linear foot. A typical 150 ft backyard fence costs $2,000-$5,000+ depending on material, height, and number of gates. Add 40-60% to material cost if hiring a contractor for installation.
Does the fence calculator support vinyl fencing?
Not currently — this calculator covers wood privacy, wood picket, and chain link fencing, which use different material systems than vinyl (panel-based rather than individual pickets and rails). Vinyl fence material quantities are typically calculated by panel count rather than picket count, since vinyl comes in pre-assembled sections.
How many extra posts does a gate need?
Each gate needs 2 dedicated posts — one on each side of the opening — in addition to your regular line-post count. This calculator adds these automatically based on the number of gates you specify. Gate posts often benefit from being set slightly more robustly than standard line posts, since they carry the additional weight and swing force of the gate itself.