Fence Calculator

Enter your fence's length, height, corners, and gates to get the posts, rails, pickets or panels, gravel, and bags of post concrete, every count rounded up, with the post depth worked out from Quikrete's and the fence makers' own rules.

What kind of fence?

Does the fence stop at the house or a lot line, or go all the way around?

Post size

How deep do the posts go?

Concrete bag

Put this calculator on your website for free

Copy one snippet and give your visitors a working Fence Calculator.

How the fence math works

A fence is a row of posts with something hung between them, so everything starts with the posts. We take your total length, subtract the gates, and split what is left into straight runs: a fence with two corners and open ends has three runs, and one that goes all the way around a rectangle has four. Each run is divided into sections no longer than your post spacing, rounding up, because 8 feet between posts is a maximum, not a quota. Posts land at every section break, every corner, both sides of every gate, and the two ends. Then each post gets a hole three times its width, 6 inches of gravel, and concrete, and each section gets its rails and pickets or its panel.

The one assumption to know about: with only a total length to go on, we split the fence evenly across its runs. Real sides are rarely equal, and each run rounds its own last section up, so your count can move by a post here or there. Stake the line out before you buy the last few posts.

The formula

sections per run = ⌈run length ÷ spacing⌉  ·  posts = sections + gates + 1 (open ends) or sections + gates (all the way around)
post depth = ½ × height above ground  ·  hole = 3 × post width  ·  concrete = (πr² − post²) × (depth − 3 in)
rails = sections × max(2, ⌈height ÷ 2 ft⌉)  ·  pickets per run = ⌈(run + gap) ÷ (picket + gap)⌉

The brackets ⌈ ⌉ mean round up. The run is one straight stretch between corners or ends, the spacing is the most you allow between posts, r is the hole's radius, and the concrete depth stops 3 inches below the ground so the top of the hole can take soil. Gravel is 6 inches in the bottom of every hole, under the post.

Worked example

A 6 ft wood privacy fence, 150 ft long, around three sides of a backyard: two corners, open ends at the house, and one 4 ft gate, with 4x4 posts at the usual 8 ft. Take out the gate and there are 146 ft of fence in 3 runs of 48.67 ft. Each run is 48.67 ÷ 8 = 6.08 sections, rounded up to 7 sections of 6.95 ft, so 21 sections in all, and 21 + 1 gate + 1 = 23 posts: 2 ends, 2 corners, 2 gate posts, and 17 line posts.

Half of 72 in above ground puts the line posts 36 in down, and the six end, corner, and gate posts 6 in deeper, at 42 in, so every post is a 10 ft 4x4. The holes are 10.5 in across. Each line post takes 1.42 cu ft of concrete (3.79 bags of 50 lb fast-setting) and each end, corner, or gate post 1.68 cu ft, for 34.2 cu ft in all: 91.2 bags, so buy 92 bags, plus 14 bags of gravel. Three rails a section makes 63 rails, and 5.5 in pickets butted tight come to 330 pickets with the gate clad to match.

Headline: 23 posts, 330 pickets, and 92 bags of concrete for 150 feet of privacy fence.

The fence post problem: why 10 sections need 11 posts

Build a straight 80 ft fence with posts 8 ft apart and you get 10 sections, but you need 11 posts, because the fence has to start on a post and end on one. Mathematicians call this the fence post problem, and it is the most common way to be off by one, in carpentry and in computer code alike. Outdoor Essentials puts it plainly in its panel instructions: one post per panel, plus one to finish the run.

Two twists make fences more interesting than the textbook version. A fence that goes all the way around gets its extra post back: its last section ends on the post it started from, so a closed loop needs exactly one post per opening. And a gate is an opening with no fence in it, so it adds a post without adding a section. That is why the formula reads sections + gates + 1. Pickets have the same puzzle in miniature: k pickets have only k − 1 gaps between them, which is why the gap appears on both sides of the picket formula.

How deep should fence posts go?

You will see two rules of thumb, and they turn out to be the same rule. Quikrete's data sheet says the hole should be a third of the whole post. Its calculator page says half the height above ground, and gives the example of a 6 ft fence on a 9 ft post with 3 ft in the ground. A post that is a third underground is two thirds above, and a third is exactly half of two thirds, so the two sentences describe the same post. Quikrete's setting-posts page widens it to a range of a third to half the height above ground, plus 6 inches for gravel.

The familiar 8 ft post with 2 ft in the ground, on a 6 ft fence, is the shallow end of that range: a third of the height above ground. Switch the depth rule above and the example fence drops from 92 bags of concrete to 60, and its line posts from 10 ft to 8 ft, which is exactly why the shallow end is popular. The deeper rule buys stiffness against wind on a solid privacy fence, which catches the wind like a sail. Either way, three more rules apply. End, corner, and gate posts carry the pull of everything attached to them, so Outdoor Essentials sets them at least 6 inches deeper. Where the ground freezes, a post that stops above the frost line can be heaved up by it, so enter your frost depth and the calculator takes the posts below it. And your town may have its own number, which wins.

How much concrete per fence post?

Quikrete's own data sheet offers a lovely check: two 50 lb bags of fast-setting concrete set a 3 in post in a 9 in hole 30 in deep. Fill that hole to the brim and it would take 2.62 bags. Leave Quikrete's 6 in of gravel in the bottom and 3 in of soil at the top, the way its instructions describe, and it takes 1.77 bags, which is the two bags. Quikrete's online calculator fills the whole hole, so it lands at three bags for the same post. Both answers are right: one is sizing for a hole with nothing else in it, the other for the method on the bag, and this page uses the method on the bag.

The bag also comes in bigger sizes: a 60 lb bag of fast-setting makes about 0.45 cu ft and an 80 lb bag of regular concrete mix about 0.60 cu ft. Fast-setting mix goes into the hole dry and gets its water poured on top, so a bag split between two holes is no trouble. That is why we round the total, not each hole. For anything bigger than posts, our concrete calculator handles slabs and footings.

Before the first hole: 811, the line, and the rules

Every fence project starts with a free phone call. Dial 811 (or use your state's 811 website) a few business days before you dig and the utilities will mark their buried lines. The national 811 program says fence installs absolutely require the call, and it is not a formality: many utility lines sit only a few inches down, and every state has a damage prevention law, with penalties for skipping it. Keep your holes clear of the marks.

Then find the property line, which is not always where the old fence was, and read your HOA rules and your town's fence rules. Height limits are common, often lower in front yards than behind the house, and many towns want a permit. If the fence doubles as a pool barrier, the pool code wants it at least 48 in tall with no opening a 4 in ball can pass, and the calculator checks the picket gap for you. For the lumber side of the budget, our board foot calculator turns rails and posts into board feet and a price.

Sources

Where the numbers on this page come from. We go to the body that publishes the figure, not to another calculator. See how we verify.

Frequently asked questions

How do you calculate how many fence posts you need?

Divide each straight run by your post spacing and round up to get sections, then remember that a run needs one more post than it has sections, because it starts and ends on a post. For the whole fence, posts = sections + gates + 1 if the fence has open ends, or sections + gates if it goes all the way around. A straight 80 ft fence with posts 8 ft apart is 10 sections and 11 posts.

How deep should fence posts be?

Quikrete's rule is a third of the whole post in the ground, which is the same as half the height above ground: a 6 ft fence on a 9 ft post, 3 ft deep. The popular 8 ft post with 2 ft in the ground is the shallow end of its range, a third of the height above ground. Dig 6 in deeper for gravel, go below the frost line where the ground freezes, and set end, corner, and gate posts at least 6 in deeper than the rest.

How many bags of concrete do I need per fence post?

For a 4x4 in a 10.5 in hole on 6 in of gravel, about 3.79 bags of 50 lb fast-setting concrete when the post goes 36 in deep, or 2.41 bags at 24 in. Quikrete's own data sheet says two 50 lb bags set a 3 in post in a 9 in hole 30 in deep. Round the whole job up, not each hole, since a bag can be split between holes.

How far apart should fence posts be?

Eight feet center to center is the usual maximum for a wood fence, the span of an 8 ft rail or a standard panel. Treat it as a ceiling: a 48.67 ft run gets 7 sections of 6.95 ft, not 6 sections and a leftover. For prefab panels, space the posts by the panel width, plus the post width if the panels fit between the posts.

How many pickets do I need for a privacy fence?

Divide the fence length in inches by the picket width. With 5.5 in pickets (a 1x6) butted tight, a straight 100 ft fence takes 1,200 divided by 5.5, which rounds up to 219 pickets. For a spaced picket fence, add the gap: 3.5 in pickets with 3.5 in gaps take 172 over the same 100 ft, because k pickets have only k minus 1 gaps between them.

How many rails does a wood fence need?

One rail for every 2 ft of height, and never fewer than two: a 4 ft fence gets 2 rails a section, a 6 ft fence gets 3, and an 8 ft fence gets 4. Multiply by the number of sections. Each rail spans one section, so posts 8 ft apart take 8 ft 2x4s.

Do I need to call 811 before putting in a fence?

Yes. 811 is a free national service: call it or use your state's 811 website a few business days before you dig, and the utilities will mark their buried lines. The 811 program names fence installs as a project that absolutely requires the call, many lines are buried only a few inches down, and every state has a damage prevention law.

Should I put gravel under fence posts?

Quikrete and Outdoor Essentials both say yes: 6 in of gravel or crushed stone in the bottom of the hole, so water drains away from the end of the post. The post stands on the gravel, concrete goes around it to 3 to 4 in below the surface, and soil covers the top. That is why the hole is dug 6 in deeper than the post goes.

Related calculators