Calculator

Fence calculator

This estimates posts, sections, rails, and pickets from run length, maximum spacing, and any gate openings you enter.

How to measure your fence

Walk the line with a tape or a wheel, at the ground.

Round each length up to the nearest half foot.

A corner is where one run ends and the next starts. If those runs share the post, say so, so it is not ordered twice.

A gate is the opening, not the leaf. Measure that width, and put the fence on either side. Do not enter the same stretch on two runs.

Units

Printed on the estimate. Stored only in this page.

Runs

Each run is fence, then an optional gate, then the fence after that gate. A gate in the middle is two fence lengths. A gate at the end keeps the following length at 0. The two posts beside a gate are not one shared corner post.

Fence runs seen from above A plan view of straight runs, a corner that shares one post, a closed loop, and a gate with its own posts on each side. start corner post run 1 run 2 run 3 run 4 closed loop gate gate posts
A plan view of straight runs, a corner that shares one post, a closed loop, and a gate with its own posts on each side.

Shorter than the spacing is still one bay and two posts.

ft
Fence
Parts of a fence section A fence section with posts, rails, pickets, the gap between pickets, post spacing, and fence height. posts pickets gap rails post spacing fence height
A fence section with posts, rails, pickets, the gap between pickets, post spacing, and fence height.
The three fence styles The three styles: picket with a gap, board panel with boards butted, and post-and-rail with no pickets. Picket,with a gap Board panel,boards butted Post-and-rail,no pickets
The three styles: picket with a gap, board panel with boards butted, and post-and-rail with no pickets.

8 ft is a planning default, not a national code limit. Many local rules use a shorter maximum. This tool does not check a permit.

ft

Under 2 ft or over 12 ft still calculates, with a warning.

ft
ft

Applied once to pickets, rails, and gate-frame boards. Allowed range 0 to 30. Posts are not padded.

%
Boards

Presets are PS 20-25 minimum dressed dry widths, not a promise that the board in the rack matches them. Measure, or type a width.

in
in
ft
Gates and concrete
Optional prices you type

Example result. Example 1.

You’ll need 13 posts, 12 sections, 24 rail boards and 216 pickets for this layout.

Shopping list

Want a more detailed estimate? Fill in the optional prices above.

Side yard

  • 13 Posts

    Includes posts beside gates. Waste is not applied. Length and bury depth are not calculated.

  • 12 Sections

    Infill bays after gate openings are removed. One prefabricated panel per section if you buy panels instead of loose pickets.

  • 24 Rail boards (8 ft)

    24 before 0% waste, applied once.

  • 216 Pickets or boards

    216 before waste, including gate leaves.

No prices entered. This page does not invent a market price.

Assumptions for this estimate
  • Spacing rule: stretch, per fence stretch. Each length of fence between gates, or from an end to a gate, is divided into the fewest equal bays that stay at or under the maximum spacing. A gate in the middle is not the same as one fence length with the gate width subtracted: each side is rounded on its own, so the bay count can be higher.
  • No gate is in this layout. Fence length is the whole run.
  • Purchase count for pickets is face-mounted on the on-center bay. The dressed width you enter is the actual board width, not the nominal size. The count is the smallest whole number that keeps the gap at or under your maximum, with a board at each end of that bay. Post thickness is not subtracted. Fitting only whole boards in the clear gap between post faces can leave an uncovered strip, and that lower count is not what this tool buys.
  • 8 ft is only the starting maximum spacing. It is not a national code limit. Local rules are often tighter. This tool does not check a permit.
  • Runs do not share posts. Each run keeps both end posts.
  • Picket count is the minimum that keeps the gap at or under the maximum you set, assuming a picket at each end. If the boards run a little past the opening, tighten the gaps rather than dropping a board from the order.
  • Waste of 0% is applied once to pickets, once to rail boards, and once to gate-frame boards after each of those counts is totaled. It is not applied to posts, hinges, latches, or concrete.
  • Rail boards are packed per run. Offcuts are not moved to another run. Waste is then applied once to the summed board count.
  • Each gate frame is counted as two stiles the height of the fence, one rail per rail line across the full opening, and one diagonal. Real leaves are a little narrower for hinge and latch clearance, so this can overcount length slightly. It does not drop a board for that clearance.
  • Concrete, when included, is bags per post times installed posts. Spare posts do not get bags. Hole volume is not calculated, and no bag yield is assumed.
  • A run shorter than the maximum spacing is still one bay with two posts. The spacing used is the run length, which is under the maximum.
  • This is a purchase count for planning. It is not an engineering design, a footing detail, a wind check, or a building-code determination.

What to buy next

  • Take the shopping list to the yard.
  • Match the rail and picket lengths to boards you can actually buy, and measure the dressed width before you trust a nominal 1×4 or 1×6.
  • If you buy panels instead of loose pickets, order one panel per section and ignore the picket line.
  • No brand and no stock level is stated here.

Formula

Each fence stretch is divided by the maximum spacing and rounded up into equal bays. A gate is its own opening between stretches, so a gate in the middle rounds each side on its own. Posts = openings + 1 on a straight run. The two posts beside a gate are the end posts of the fence on either side.

Pickets cover the on-center bay with the actual board width you enter. The count rounds up so the gap does not exceed the maximum. It does not subtract the post and then drop a board. Rails are cut from the board length you enter. Waste is applied once. Posts are an exact count. Eight feet is a default, not a national code.

Last reviewed 8 November 2026. Full method, rounding, and sources.

When this formula is wrong

  • The fence curves, steps down a slope, or the posts will not be spaced evenly.
  • You plan full bays at the maximum spacing plus one short leftover bay. This tool stretches instead, and it says so.
  • Two gate leaves share one opening. Enter that as one width. Adjacent gates with a post between them are two widths.
  • A gate is also the corner where two runs meet. Put the gate in the run sequence, and do not also turn on corner sharing for that joint.
  • You need a wind, soil, post-size, or bury-depth check. None of that is in the count.
  • A prefabricated panel has a fixed width that does not match the bay width shown.
  • Board-on-board, shadowbox, lattice, and dog-ear profiles are not separate modes.

Worked examples

These three use the same functions as the form. Load them with the buttons on the calculator.

  1. 1. Even bays, no gate

    A straight 96 ft picket run at an 8 ft maximum spacing. Ninety-six divides by eight, so the bays stay 8 ft.

    Inputs

    • Fence lengths: 96 ft
    • Maximum post spacing: 8 ft
    • Height: 6 ft
    • Style: picket
    • Gates: none
    • Waste: 0%

    Intermediates

    • Infill after gates: 96 ft
    • Equal bays: 12
    • Bay width: 8 ft
    • Posts: 13
    • Pickets before waste: 216
    • Rail boards before waste: 24

    Result. You’ll need 13 posts, 12 sections, 24 rail boards and 216 pickets for this layout.

  2. 2. Length that does not divide evenly

    A straight 100 ft post-and-rail run. One hundred does not divide by eight. Spacing is stretched; there is no 4 ft leftover bay.

    Inputs

    • Fence lengths: 100 ft
    • Maximum post spacing: 8 ft
    • Height: 4 ft
    • Style: rail
    • Gates: none
    • Waste: 0%

    Intermediates

    • Infill after gates: 100 ft
    • Equal bays: 13
    • Bay width: 7.692 ft
    • Posts: 14
    • Pickets before waste: 0
    • Rail boards before waste: 13

    Result. You’ll need 14 posts, 13 sections and 13 rail boards for this layout.

  3. 3. One gate, with waste

    An 80 ft line with 76 ft of fence and a 4 ft gate at the end. The gate is its own opening, then 10% waste is applied once.

    Inputs

    • Fence lengths: 76 ft, 0 ft
    • Maximum post spacing: 8 ft
    • Height: 6 ft
    • Style: board
    • Gates: 4 ft
    • Waste: 10%

    Intermediates

    • Infill after gates: 76 ft
    • Equal bays: 10
    • Bay width: 7.6 ft
    • Posts: 12
    • Pickets before waste: 179
    • Rail boards before waste: 30

    Result. You’ll need 12 posts, 10 sections, 33 rail boards and 197 pickets for this layout. 1 gate opening is removed from the infill. Rail boards and pickets include 10% waste applied once. Posts do not.

Questions

Does the fence count include a gate?

Only if you enter a gate count and a total gate width. That width is subtracted from the infill and shown in the result. A blank or zero gate is not subtracted. The tool never drops gate width quietly.

Why did the post spacing change when my length is not divisible by 8?

The spacing rule is stretch. The run is split into the fewest equal bays that do not exceed the maximum you set. A 100 ft run with an 8 ft maximum becomes 13 bays at about 7.69 ft, not 12 full bays plus a 4 ft leftover.

What if the fence turns a corner?

Add a run for each straight side and check “runs share corner posts” so the corner is not ordered twice. Check “closed loop” only when the fence returns to its start, such as a four-sided yard.

How is waste applied?

Once, after the picket count is totaled, once after the rail-board count, and once after the gate-frame count. It is not applied again per bay, and it is not applied to posts or hardware. The field accepts 0 to 30 percent. A higher entry is cut back to 30 and the estimate says so. The 10 percent starting value is a planning default, not a measured scrap rate.

Can I use this for a permit or a structural check?

No. The result is a shopping count. It does not size posts, set bury depth, check wind, or read your local fence rules. A height under 2 ft or over 12 ft is flagged and still counted.

Methodology

Last reviewed 8 November 2026. The spacing rule is stretch. Waste on the opening example is 0. You can type 0 to 30 percent; a higher number is cut back to 30. Ten percent is only a planning allowance for offcuts, not a measured scrap rate. Sources are on the methodology page.