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
- Enter fence length (ft) (above 0).
- Enter post spacing (ft) (above 0).
- Enter rails per section (a whole number, between 1 and 6). It starts at 2.
- Enter picket width (in) (above 0).
- Enter gap between pickets (in) (0 or more).
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| Fence length | A number, in ft | > 0 |
| Post spacing | A number, in ft | > 0 |
| Rails per section | A whole number | ≥ 1, ≤ 6, starts at 2 |
| Picket width | A number, in in | > 0 |
| Gap between pickets | A 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.
| Result | Value |
|---|---|
| Posts | 14 |
| Sections | 13 |
| Rails | 26 |
| Pickets | 200 |
Example 2
Inputs: Fence length = 64; Post spacing = 6; Rails per section = 3; Picket width = 3.5; Gap between pickets = 1.
| Result | Value |
|---|---|
| Posts | 12 |
| Sections | 11 |
| Rails | 33 |
| Pickets | 171 |
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.
| Fence length | Posts | Sections | Rails |
|---|---|---|---|
| 50 | 8 | 7 | 14 |
| 100 | 14 | 13 | 26 |
| 200 | 26 | 25 | 50 |
| 400 | 51 | 50 | 100 |
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.
| Calculator | You enter | It returns |
|---|---|---|
| [Fence Stain Calculator](/construction/fence-stain-calculator/) | fence length, fence height and coats | Stain needed |
| [Roof Pitch Calculator](/construction/roof-pitch-calculator/) | i know the and value | Pitch |
| [Tile Calculator](/construction/tile-calculator/) | area to tile, tile length and tile width | Tiles needed |
| [Aquarium Volume Calculator](/construction/aquarium-volume/) | length, width and water height | Capacity |
| [Flooring Calculator](/construction/flooring-calculator/) | room length, room width and waste allowance | Flooring 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.
Related calculators
- 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.
- Aquarium Volume Calculator — Capacity and filled weight of a rectangular aquarium.
- Flooring Calculator — Flooring area with waste, and boxes if you know the coverage per box.
- Roof Shingles Calculator — Squares and bundles of shingles for a roof area.
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.