Free tool
Fence Calculator
Work out the posts, boards and rails for a fence from its length, post spacing, gates and board width, with the arithmetic shown step by step.
Gates
Boards and rails
- Posts
- –
- Sections between posts
- –
- Boards or pickets
- –
- Rails
- –
- Fenced length after gates (feet)
- –
The working
Assumptions and limits
No post spacing or board size is built in as a recommendation. The starting values only make the example work.
- Sections = fenced length ÷ post spacing, rounded up. Posts = sections + 1 on a straight fence, or sections on a closed loop, plus any extra posts you enter.
- Boards = fenced length ÷ (board width + gap), rounded up after the extra percentage. They are laid side by side along the length.
- Rails = sections × rails per section. Post spacing, board width, gap and rail count are exactly what you type.
- Post depth, concrete, panel sizes, gate hardware and building or boundary rules are not part of this calculation. Check local rules and your product instructions.
Runs entirely in your browser. Nothing you type or upload is sent to our servers.
How to work out fence posts, boards and rails
A fence is a series of equal sections between posts, so most of the counting comes down to division and rounding up. Measure the line the fence will follow, subtract any gate openings, decide how far apart the posts will be, and the rest follows. Because every length accepts feet, inches, yards, meters or centimeters, you can type each figure the way you measured it.
Formulas
- Fenced length: total length − gates × gate width.
- Sections: fenced length ÷ post spacing, rounded up.
- Posts: sections + 1 (straight) or sections (closed loop), plus extra posts.
- Boards: fenced length ÷ (board width + gap), rounded up. Rails: sections × rails per section.
Worked example 1: a straight 100 foot fence
- Sections: 100 ÷ 8 = 12.5, rounded up to 13.
- Posts: 13 + 1 = 14.
- Each board uses 5.5 + 0.5 = 6 inches = 0.5 feet, so boards: 100 ÷ 0.5 = 200.
- Rails at 2 per section: 13 × 2 = 26.
Worked example 2: the same line with one 4 foot gate
- Fenced length: 100 − 4 = 96 feet.
- Sections: 96 ÷ 8 = 12 exactly, so 12 and 13 posts.
- Boards: 96 ÷ 0.5 = 192.
- With 5% extra boards: 192 × 1.05 = 201.6, rounded up to 202.
Planning tips
- Measure along the real fence line, not a straight line across the yard, and add the length of each leg.
- If the last section comes out short, you can even out the spacing by dividing the fenced length by the number of sections.
- Price posts, boards and rails separately, since each count is a separate line in a supplier quote.
Related tools
Post holes need concrete, so the Concrete Calculator handles round piers. If you are buying lumber by volume, use the Board Foot Calculator. Check the area enclosed with the Square Footage Calculator, then plan a surface inside with the Deck Calculator or fill beds with the Mulch Calculator.
Frequently asked questions
How many fence posts do I need?
Divide the fenced length by the space between posts and round up to get the number of sections. A straight fence needs one more post than it has sections, because both ends need a post. A fence that closes into a loop needs as many posts as sections. For 100 feet at 8 feet between posts, that is 13 sections and 14 posts on a straight run.
How far apart should fence posts be?
This calculator does not choose a spacing for you. The right distance depends on the fence type, the panels or rails you buy and local rules, so use the spacing in the instructions for your product or the figure your local building office requires. Enter that spacing above and the counts follow. Changing it shows how many posts a different layout would need.
How do I account for gates?
Enter how many gates there are and how wide each opening is. The width of the gates is subtracted from the fence line before sections and boards are counted. Gate hardware and the posts that hold a gate can differ from ordinary posts, so use the extra posts box to add whatever your plan calls for.
How many pickets or boards will I need?
Divide the fenced length by the width of one board plus the gap between boards, then round up. With 5.5 inch boards and a half inch gap, each board uses 6 inches, so 96 feet of fence needs 96 × 12 ÷ 6 = 192 boards. For a solid fence, set the gap to 0. The extra percentage covers cuts and any boards you reject.
How many rails do I need?
Enter how many horizontal rails each section has, and the calculator multiplies it by the number of sections. That gives the number of rails if each one spans one section. If you buy longer rails and splice or span several sections with each, divide the figure by the number of sections per piece.
Does this work for a corner or irregular boundary?
Measure the total length along the fence line, going around each corner, and enter it as one length. Corners usually need their own posts, so use the extra posts box to add them. For a perimeter that closes back on itself, tick the closed loop option so the end post is not counted twice.
Is anything I enter saved or sent?
No. The numbers are worked out in your browser, and nothing you type reaches our servers. Analytics only record that the calculator was used. Your measurements stay on your device and are cleared when you close the tab, so note down the post, board and rail counts if you need them later.
Link to this tool
Found it useful? Copy a link for your page, newsletter or documentation.
Get new tools and guides by email
Optional. The tool above works without signing up.
More free tools
Browse all construction calculators or the full list of free tools.
- Deck CalculatorEstimate decking boards, linear feet and joists for a rectangular deck from your board width, gap, board length and joist spacing.
- Tile CalculatorCalculate how many tiles and boxes cover a floor or wall, including the grout joint and an extra allowance for cuts that you set yourself.
- Roofing CalculatorFind roof surface area from the building outline and pitch, then count shingle bundles from the coverage printed on your package.
- Square Footage CalculatorFind the area of a room, L-shape, triangle, circle or trapezoid in square feet, yards and meters, with a waste allowance and a package count.
- Morse Code TranslatorTranslate text to Morse code and Morse to text, play it as sound at an adjustable speed, or show it as a flashing light. Runs in your browser.
- Binary to Text ConverterConvert binary to text and text to binary with correct UTF-8 handling for accented letters and emoji. Paste, copy and swap direction in your browser.