Rectangle Fence Perimeter Calculator uses P=2(L+W) to calculate fence perimeter, posts, rail boards, pickets, and corner diagonal from length, width, post spacing, and picket width. No gates included.
What This Calculator Actually Computes
Most fence material estimates fall apart at the post count. Someone measures the perimeter, divides by post spacing, and ends up three posts short on install day. The reason: you can’t split a span. A 42-foot run at 8-foot spacing needs six spans — not 5.25. This calculator uses ceiling math throughout, so every output already accounts for that rounding-up reality before you order anything.
Beyond the perimeter itself, the tool produces four things: post count, horizontal rail boards, vertical pickets, and the corner-to-corner diagonal you’ll need to square the layout before a single post goes in the ground.
How Each Number Gets Calculated
Perimeter is straightforward — 2 × (length + width). Everything else builds from it.
Post count works by calculating spans per side independently. The length side gets ⌈length ÷ spacing⌉ spans; the width side gets ⌈width ÷ spacing⌉ spans. Total posts = 2 × length spans + 2 × width spans. Corner posts aren’t double-counted — each corner belongs to one side’s interval, so the formula handles sharing automatically.
Rail boards assume a standard two-rail fence. Total rail length equals perimeter × 2, then divided by 8 ft (or 2.44 m in metric) per board, ceiling-rounded. If your fence design uses three rails, the actual material need is 50% higher than what’s shown — the tool doesn’t have a rail-count input, so adjust manually.
Picket count divides the full perimeter by the picket face width you enter. The picket width input is in inches (US) or centimeters (metric) precisely because picket lumber is sold and specified in those smaller units, while the fence dimensions live in feet or meters. The conversion happens internally — you don’t need to do it yourself.
Diagonal is pure Pythagorean: √(L² + W²). You’ll use this measurement when staking out the rectangle before digging. Drive two corner stakes, measure the diagonal, adjust until both diagonals match — that’s a square layout.
Pickets: The Gap Assumption That Catches People Off Guard
The picket calculation divides total perimeter by picket width with no gap factored in. That’s intentional and correct for privacy fences where boards sit flush edge-to-edge (or board-on-board with overlap). For a traditional picket-style fence — say, 3.5-inch boards with 3.5-inch gaps — this calculator will give you roughly twice as many pickets as you actually need.
Before you run the number, decide what style you’re building. Tight-fit privacy fence: use this as-is. Spaced decorative pickets: calculate one span manually (span length ÷ (picket width + gap width), then multiply by number of spans. The two situations produce completely different quantities, and the input field alone can’t tell which one you’re planning.
Worked Example: Backyard Dog Run, 55 × 22 ft
A 55 by 22-foot rectangle at 8-foot post spacing with standard 5.5-inch dog-ear pickets.
- Perimeter: 2 × (55 + 22) = 154 ft
- Length spans: ⌈55 ÷ 8⌉ = 7 spans
- Width spans: ⌈22 ÷ 8⌉ = 3 spans
- Posts: 2×7 + 2×3 = 20 posts
- Rail boards (2 rails): 154 × 2 = 308 ft total ÷ 8 = 39 boards
- Pickets: 154 ft ÷ (5.5 ÷ 12) ft = 154 ÷ 0.4583 ≈ 336 pickets
- Diagonal: √(55² + 22²) = √(3025 + 484) = √3509 ≈ 59.2 ft
That diagonal number mattered on this job. The yard had a slight slope on the long side, and measuring 59.2 ft corner-to-corner confirmed the stakes were true before any holes were dug. Without it, the width-side posts would have drifted out of parallel by about 4 inches across the run.
Add 10–15% to all material counts for waste, bad boards, and re-cuts. On 336 pickets that’s 34–50 extra boards — worth having on-site rather than making a second trip.
Frequently Asked Questions
My side length divides cleanly into my post spacing — why does the calculator still show an extra span sometimes?
It shouldn’t if the division is exact. But if floating-point arithmetic produces something like 4.9999999 instead of 5.0, the ceiling function returns 5 rather than 4. If you see a post count that’s one higher than expected on a round number, try entering the dimension with one decimal place (e.g., 40.0 instead of 40) — it won’t change the math but sometimes resolves display edge cases. In practice, any real-world measurement has slight variance, so rounding up is the safe behavior anyway.
If I switch from US to metric mid-calculation, do my entered values convert automatically?
Yes. Switching the unit system converts all existing field values in place — length, width, and spacing multiply or divide by 0.3048 (the ft-to-m factor), and the picket width converts between inches and centimeters using the 2.54 factor. You don’t need to re-enter anything. The results update immediately after the switch.
The picket count seems way too high for my fence style — is something wrong?
Probably not — see the gap assumption section above. The tool counts pickets edge-to-edge across the full perimeter. If you’re building an open-style fence with gaps between boards, divide the result by roughly 2 (for equal board and gap widths) or calculate the actual ratio for your specific gap. The tool doesn’t have a gap input.
Why does the rail board count assume exactly two rails?
Two horizontal rails — top and bottom — is the most common configuration for residential privacy fencing. The calculation is simply perimeter × 2 ÷ 8 ft per board. If your design calls for three rails (common on taller 6-foot fences for added rigidity), multiply the board count by 1.5. The tool shows total rail length in the detail row so you can do that math directly without re-running anything.