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

Ready to run the numbers?

Open Fence Calculator