The fence line is the most claimed and most wasted ground in the garden: a long, narrow, already-defined strip that begs for a raised bed and then punishes the obvious build. The obvious build, a three-sided box that uses the fence as its fourth wall, rots the fence boards from the soil side, traps moisture against the wood, and gives the gardener no way to maintain the fence without dismantling the bed. The second failure is slower: the bed is built beautifully and then grows badly, because nobody audited the fence's shadow, and a north-side fence line in the northern hemisphere is a part-shade site wearing a sunny costume. This page builds the fence bed correctly: an independent four-sided bed held off the fence by an air gap, sized to the fence's own structure, and planted according to a sun audit done before construction. The material builds elsewhere on this site, brick, cinder block, and sleeper, can all execute the same plan; the fence rules are about position, not material.
Home / Garden Projects and Outdoor Living
How to Build a Raised Bed Against a Fence: The Gap, the Back Board, and the Sun Audit

Photo: Nhi Huynh / Pexels
Fence Line Raised Bed Build Checklist
Check off each step as you finish it. Your progress stays on this page.
0 of 8 complete
0% done
The Sun Audit: Orientation Decides the Crop
Before any building, stand at the fence at breakfast, noon, and late afternoon on a sunny day and record where the shadow falls, because the fence is a sun machine with four settings. A bed on the south side of an east-west fence, in the northern hemisphere, gets full sun and reflected warmth, the premium site in the garden, suited to the heat roster, tomatoes in a vegetable plan, or the sun flowers of the flower pages. A bed on the north side of that same fence sits in the fence's shadow for much of the day, deeper in winter when the sun is low; it is a part-shade to shade bed, honest ground for ferns, hostas, leafy greens, and shade perennials, and a disappointment for anything sold as full sun. Beds along north-south fences split the day: the east side takes morning sun and afternoon shade, the classic hydrangea and leafy-crop site, and the west side takes the reverse, gentle mornings and fierce afternoons, which suits heat lovers and stresses the thirsty. Measure the hours of direct sun on the soil line in the growing season and plant to the measurement, not to the hope. The audit also catches the rain shadow: a fence line under eaves or a tree canopy can be dry ground even in a wet garden, and such a bed needs either irrigation planned into the build or a drought roster chosen on purpose.
The Gap and the Back Board: Protecting the Fence
The build's defining dimension is the gap: leave at least 12 inches between the back of the bed and the fence. The gap does four jobs. It moves soil moisture off the fence boards, which is the rot prevention that decides whether the fence outlives the bed. It lets air circulate behind the bed, drying both structures after rain. It gives the gardener a maintenance slot, room to paint, repair, or replace a fence board without emptying the bed. And it lets the fence be replaced entirely, someday, by a crew that never touches your soil. Inside the gap, lay a strip of gravel or coarse stone over the bare ground: it suppresses the weeds that would otherwise colonize the slot, drains the drip line off the fence, and keeps the maintenance path walkable. The bed itself is a complete four-sided box with its own back board, built exactly as a freestanding bed is built, because it is one; the fence is scenery and microclimate, never structure. Where the fence is a neighbor's, the gap is also diplomacy: soil, water, and rot kept entirely on your side of the line, and a bed that can be removed without a trace when the fence is renewed.

Sizing to the Post Bays
A fence is built in bays, the sections between posts, typically 6 or 8 feet, and the bed that respects the bays is stronger and better looking than the bed that ignores them. Size bed modules to the bay length so each bed section sits within one bay, with its ends at the posts. The posts are the fence's strong points and its visual rhythm; a bed that ends mid-bay looks accidental, and a bed that crosses a post buries the post's base in the maintenance gap where it rots unseen and cannot be serviced. Two 8-foot bays make two 8-foot beds with a post-width break between them, which also gives the gardener access points to the gap along the run. Height follows the fence's exposure: a single-board or two-board bed, 8 to 16 inches of soil, suits the fence line, where taller beds crowd the fence visually and hold more moisture near it. Depth of soil follows the planting plan as on the other build pages, with the fence-specific warning that the back row of a fence bed dries slower and shades its own roots, so moisture-loving plants belong at the back and the drought roster at the sunny front edge, the reverse of an island bed's arrangement.
The Fence as Microclimate: Using the Wall
Built correctly, the fence stops being a hazard and becomes the bed's best feature. A sun-facing fence is a heat store: it warms the bed in spring weeks before open ground, shelters it from wind, and reflects light into the planting, which is why fence lines are the traditional home of espaliered fruit, early peas, and the tender plants a garden coddles. Use it deliberately. Plant the warmth lovers, figs and Mediterranean herbs in suitable climates, peppers and basil in a vegetable plan, against the sun-facing fence and let the wall do its work. The fence is also a trellis that costs nothing: peas, beans, cucumbers, and climbing flowers can be run up wires or netting fixed to the bed's back board and the fence posts, with the gap ensuring the climbers' roots sit in the bed while their tops use the fence's height, and the fence itself never carries soil or standing moisture. Wind shelter cuts both ways and deserves one caution: a solid fence creates a still, humid pocket on its lee side in wet weather, so the fence bed in a rainy climate wants the airiest planting, the spacing benches at their wide ends, and no irrigation that wets foliage late in the day. The microclimate is a tool; the audit at the top of this page is how you learn which way yours points.
Watering a Fence Bed: The Rain Shadow and the Drip Line
A fence bed's water behaves differently from an island bed's, in both directions, and the build should anticipate it. Along the fence's base runs a rain shadow: the fence itself sheds rainfall outward, and a bed tucked near a tall fence under trees or eaves can receive a fraction of the rain that falls two feet away, so the back rows of a fence bed are often the driest ground in the garden despite sitting in shade. Test with a rain gauge or a straight-sided can at the back of the bed after a storm before assuming the bed is watered by weather. The countervailing effect is the drip line: rain running off the fence and any overhanging roof lands in a concentrated line, and the gap's gravel strip exists partly to receive that drip without splashing soil against the bed's back board. The practical program is a soaker hose or drip line run along the bed's length, which delivers water evenly to the shadowed back and the sunny front alike, and a mulch layer that flattens the difference between the drip line's excess and the shadow's deficit. Gardeners who water a fence bed by sprinkler from the front systematically underwater its back row, which then underperforms and gets blamed on the shade the audit measured honestly at the start.
Related guides
These related guides round out the picture:
- How to Build a Raised Bed Against a Wall: Never Use the Wall
- How to Build a Raised Bed with Decking Boards: Thick Stock, Simple Math
- How to Build a Raised Bed From Pallets: The HT Stamp Build
Frequently Asked Questions
How far should a raised bed be from a fence?
At least 12 inches. The gap keeps soil moisture off the fence boards, circulates drying air, gives room to maintain or replace the fence without dismantling the bed, and keeps your soil and water on your side of a neighbor's fence. Fill the gap with a gravel strip to suppress weeds and drain the drip line.
Can I use the fence as the back wall of the bed?
No. Soil held directly against fence boards keeps them wet, rots them from the garden side, and makes fence repair impossible without emptying the bed. Build a complete four-sided bed with its own back board and hold it off the fence by the 12-inch gap. The fence is microclimate and backdrop, never structure.
What grows best in a bed against a fence?
Whatever the sun audit measures. The south side of an east-west fence is a premium full-sun, heat-storing site for sun lovers. The north side is part shade to shade, right for ferns, hostas, and leafy greens. East sides take morning sun, west sides take fierce afternoons. Audit the hours of direct sun on the soil line and plant to the measurement.
How long should fence-line beds be?
Match the fence's post bays, typically 6 or 8 feet per section, with bed ends at the posts. Beds sized to the bays look intentional, keep post bases accessible in the maintenance gap instead of buried against them, and break a long run into modules with access points.
Does a fence make a raised bed warmer?
A sun-facing fence does: it stores heat, reflects light, and shelters wind, warming its bed in spring ahead of open ground and extending the tender plants' season. The lee side of a solid fence can also be a still, humid pocket in wet climates, so plant airy, wide-spaced rosters there and avoid late-day foliage watering.
Photo credits: Nhi Huynh (Pexels); Natalia Sevruk (Pexels). Photos are served from this site; follow the credit to the library page for the original.