Fence Calculator Formula

Understand the math behind the fence calculator. Each variable explained with a worked example.

Formulas Used

Posts Needed

num_posts = num_sections + 1

Rails Needed

num_rails = fence_height > 6 ? num_sections * 3 : num_sections * 2

Pickets Needed

num_pickets = ceil(total_length * 12 / picket_width)

Variables

VariableDescriptionDefault
total_lengthTotal Fence Length(ft)100
fence_heightFence Height(ft)6
post_spacingPost Spacing(ft)8
picket_widthPicket Width(in)3.5
num_sectionsDerived value= ceil(total_length / post_spacing)calculated

How It Works

Fence Calculation

Posts = (Total Length / Post Spacing) + 1

Rails = Sections × Rails per Section (2 for fences ≤6ft, 3 for taller)

Pickets = Total Length (in) / Picket Width

Add 10% for waste.

Worked Example

100 ft fence, 6 ft tall, 8 ft spacing, 3.5 in pickets.

total_length = 100fence_height = 6post_spacing = 8picket_width = 3.5
  1. 01Sections = ceil(100/8) = 13
  2. 02Posts = 13 + 1 = 14
  3. 03Rails = 13 × 2 = 26
  4. 04Pickets = ceil(1200 / 3.5) = 343

Frequently Asked Questions

How deep should fence posts be set?

Posts should be buried 1/3 of their total length. For a 6ft fence, use 8ft posts buried 2ft deep in concrete.

How far apart should fence posts be?

6 to 8 feet is standard. Closer spacing (6ft) provides more strength; 8ft is the maximum recommended distance.

Learn More

Guide

How to Calculate Fence Materials

Learn how to calculate fence materials including posts, rails, pickets, and concrete for any fence length and style. Proper material estimates prevent project delays and reduce leftover waste.

Ready to run the numbers?

Open Fence Calculator