Skip to content
CalculatorAtlas

Fence Calculator

Tested

Posts, rails and pickets for a straight fence run.

Tested, not yet published. The formula for this calculator is implemented and passes its automated checks. This page stays non-indexable until it is reviewed and published.

ft
ft
in
in

Results

Enter your values and press Calculate. Results appear here.

  • • Result

Quick answer

Sections = ⌈length ÷ post spacing⌉, posts = sections + 1, and pickets = ⌈length × 12 ÷ (picket width + gap)⌉. A 100 ft fence with 8 ft spacing needs 13 sections, 14 posts, 26 rails and 200 pickets (5.5 inch with 1/2 inch gaps).

Enter the fence length, post spacing, rails per section and picket sizes. The calculator returns posts, sections, rails and pickets.

Related tools: Fence Stain Calculator: Gallons of stain for both sides of a fence. Roof Pitch Calculator: Roof pitch as rise per 12 inches, angle, slope percent and rafter length factor. Tile Calculator: Number of tiles (and boxes) for an area.

How to use the Fence Calculator

  1. Enter fence length (ft) (above 0).
  2. Enter post spacing (ft) (above 0).
  3. Enter rails per section (a whole number, between 1 and 6). It starts at 2.
  4. Enter picket width (in) (above 0).
  5. Enter gap between pickets (in) (0 or more).
  6. Press Calculate to see the result, and use Reset to start again.
Inputs of the Fence Calculator
InputWhat to enterAllowed values
Fence lengthA number, in ft> 0
Post spacingA number, in ft> 0
Rails per sectionA whole number≥ 1, ≤ 6, starts at 2
Picket widthA number, in in> 0
Gap between picketsA number, in in≥ 0

Formula and method

Formula

sections = ⌈length ÷ spacing⌉; posts = sections + 1; pickets = ⌈length × 12 ÷ (picket width + gap)⌉

IEEE-754 double precision; shown to the decimals indicated.

A straight run with a post at each end; corners and gates need extra posts. Plan geometry only; confirm quantities with your supplier and local code before ordering.

Worked examples

These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.

Example 1

Inputs: Fence length = 100; Post spacing = 8; Rails per section = 2; Picket width = 5.5; Gap between pickets = 0.5.

Results of example 1
ResultValue
Posts14
Sections13
Rails26
Pickets200

Example 2

Inputs: Fence length = 64; Post spacing = 6; Rails per section = 3; Picket width = 3.5; Gap between pickets = 1.

Results of example 2
ResultValue
Posts12
Sections11
Rails33
Pickets171

The first line is the headline result (posts). Below it the fence Calculator lists sections, rails and pickets, which describe the same case from other angles. IEEE-754 double precision; shown to the decimals indicated.

Why one more post

A line of 13 sections needs 14 posts because both ends need a post. Corners and gates need extra posts, which this estimate leaves out.

Pickets

Each picket and gap takes 6 inches, so 100 ft (1,200 inches) needs 200 pickets. Allow a few spares for cuts and damage. Gates are usually separate hardware and framing.

How the result changes with fence length

Holding every other input at the first worked example, this table changes only fence length. It shows how sensitive the answer is to that one value; each row was produced by running this calculator.

How the result changes with fence length
Fence lengthPostsSectionsRails
508714
100141326
200262550
4005150100

What happens with invalid input

These messages are produced by the calculator itself, so you know what to fix.

  • Fence length: entering "0" shows "Fence length must be greater than 0." beside that field and no result.
  • Picket width: entering "0" shows "Picket width must be greater than 0." beside that field and no result.

Choosing between the Fence Calculator and similar calculators

Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.

Choosing between the Fence Calculator and similar calculators
CalculatorYou enterIt returns
[Fence Stain Calculator](/construction/fence-stain-calculator/)fence length, fence height and coatsStain needed
[Roof Pitch Calculator](/construction/roof-pitch-calculator/)i know the and valuePitch
[Tile Calculator](/construction/tile-calculator/)area to tile, tile length and tile widthTiles needed
[Aquarium Volume Calculator](/construction/aquarium-volume/)length, width and water heightCapacity
[Flooring Calculator](/construction/flooring-calculator/)room length, room width and waste allowanceFlooring to buy

Background: construction estimates

Material quantities are geometry plus a margin. Calculate the exact volume or area, add an allowance for waste, spillage, cuts and uneven ground (calculator pages commonly mention 5 to 10 percent, a rule of thumb that varies by material and job) and round up to whole units. One cubic yard is exactly 27 cubic feet.

Suppliers often have minimum order sizes and may charge for small loads, so confirm quantities, product yields and local code with your supplier or a qualified estimator before ordering.

Assumptions and limitations

  • Add gates and corners separately

Quantities are estimates. Add allowances for waste and site conditions, and follow local codes and a qualified professional's instructions for structural or safety-critical work.

If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for fence length and picket width to confirm this.

Frequently asked questions

How far apart should posts be?

Commonly 6 to 8 feet.

How deep should posts go?

About one-third of the post's height above ground, per many guides.

Do I need a permit?

Local rules vary, so check them.

What does the Fence Calculator calculate?

Posts, rails and pickets for a straight fence run. It returns Posts, Sections, Rails and Pickets.

What formula does the Fence Calculator use?

sections = ⌈length ÷ spacing⌉; posts = sections + 1; pickets = ⌈length × 12 ÷ (picket width + gap)⌉. A straight run with a post at each end; corners and gates need extra posts.

What do I need to enter in the fence Calculator?

You enter Fence length (ft), Post spacing (ft), Rails per section, Picket width (in) and Gap between pickets (in).

How is the result rounded or limited?

IEEE-754 double precision; shown to the decimals indicated. Add gates and corners separately.

What is an example of a fence result?

With fence length 100, post spacing 8, rails per section 2, picket width 5.5 and gap between pickets 0.5, the posts is 14.

Can I rely on this calculator for a decision?

Quantities are estimates. Add allowances for waste and site conditions, and follow local codes and a qualified professional's instructions for structural or safety-critical work. For this calculator in particular: Add gates and corners separately.

Sources

  • OpenStax, Prealgebra 2e (Rice University): perimeter, area, volume, circumference and the Pythagorean theorem
  • NIST Special Publication 811, Guide for the Use of the International System of Units (SI), Appendix B conversion factors (international foot 0.3048 m, inch 25.4 mm, US gallon 3.785411784 L)

Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.