In most jurisdictions, a fence can go right up to your property line as long as every part of it stays on your land. Many local codes ask for a small setback of two to six inches so you can reach the exterior side for maintenance without stepping onto your neighbor’s lot, and some push that to a foot or more for masonry walls or taller fences. How close a fence can be to a property line ultimately comes down to your municipal zoning code, any recorded easements, and, if you have one, your HOA’s rules.
The Default Setback
The baseline in many cities is simple: on the line is fine, over the line is not. A common variation requires the fence to sit two to six inches inside the boundary so the owner can paint, stain, or repair the exterior face without trespassing. A smaller group of jurisdictions requires a full foot or more, particularly for masonry or for fences above a certain height. The specific number lives in your local zoning code, and it can vary by zoning district within the same city.
Even where the code allows a fence flush with the boundary, staying a few inches inside is usually the smarter build. If your fence sits exactly on the line and a post rots out, you need your neighbor’s permission to stand on their side while you replace it. That permission might not come, and entering without it is trespassing. Two to four inches of setback costs you almost nothing in usable yard and saves you from negotiating access every time the fence needs work.
Building Directly on the Line
A fence placed exactly on the boundary is called a partition or boundary fence, and it triggers shared obligations. Most states with partition fence statutes require adjoining landowners to share the cost of building and maintaining a division fence, roughly half each. Some older statutes divide the fence physically by compass orientation, assigning each owner a specific portion; the more modern approach is proportional cost-sharing.
These obligations can apply whether or not both neighbors wanted the fence. If you build and your neighbor benefits, many states let you recover a share of the cost. A written cost-sharing agreement recorded with the county heads off most disputes and binds future owners if either property sells. You don’t need a formal easement to build on the line; the partition statute handles the rights directly. What you do want on record is the money agreement, because an unrecorded handshake won’t follow the property to the next buyer.
Height Rules That Push the Fence Inward
Setback is only half the placement question. Fence height is regulated almost everywhere and depends on where the fence sits relative to your house. The common residential pattern allows up to six feet in side and rear yards and caps front-yard fences at three or four feet to preserve sight lines for drivers and pedestrians.
Some codes tie height to distance from the line. Washington, D.C., for instance, caps fences at seven feet when they sit within ten feet of a shared boundary and permits greater height farther in. Taller fences can also cross into structural territory under the International Building Code, which many municipalities have adopted in some form. A ten-foot privacy wall faces wind-load calculations that a four-foot picket fence never will.
Corner Lots and the Visibility Triangle
Corner lots carry an extra restriction that catches many owners off guard. Most cities establish a visibility triangle or sight distance triangle at intersections, and anything inside it must stay below a specified height, commonly 30 to 42 inches. The triangle is measured from the point where two street right-of-way lines meet, with each leg extending 15 to 25 feet along the property line. A six-foot privacy fence that would be perfectly legal on an interior lot can violate the visibility triangle on a corner lot, and code officers actively look for these violations because they create real traffic hazards. Check your municipal code for the exact dimensions before you order materials.
Easements That Override the Base Setback
Before you decide where the fence goes, pull your property survey and title documents and look for utility easements. These are recorded rights that let utility companies access strips of your land for underground or overhead lines. A fence built inside a utility easement is technically allowed in most places, but the utility can tear it down when they need access and generally owes you nothing for the damage.
Some providers make a courtesy effort to rebuild a fence they remove during maintenance; they are not legally required to. A handful of local utility districts prohibit fences within easements entirely unless you get written permission and include access gates. The safest choice is to route the fence around the easement. If you have to cross it, use removable panels instead of permanent construction.
HOA Rules Layered on Top
If your property is in a community governed by a homeowners association, the CC&Rs add restrictions on top of the municipal code. HOA fence rules commonly regulate height, materials, color, placement, and which direction the finished side faces. Chain link is frequently banned in visible areas. Front-yard fencing may be prohibited outright. Many associations require both sides of the fence to look identical so no neighbor is left facing exposed rails and posts.
Almost every HOA requires you to submit a fence plan to an architectural review committee before construction. The submission typically includes a site plan, materials and color, height, and sometimes a product photo or spec sheet. Review cycles run two to six weeks. Starting construction before you have written approval is one of the more expensive mistakes homeowners make: the HOA can fine you, order modifications or removal, and in some communities place a lien on your property for noncompliance.
Get a Survey Before You Build
A professional boundary survey is the single most important step before building a fence, and skipping it is where most fence disputes start. The surveyor locates your property corners using recorded deeds, plat maps, and physical markers like iron pins, then produces a scaled drawing of your lot showing exact boundary locations and any easements.
Residential boundary surveys typically cost between $1,000 and $5,500, depending on the size of the parcel, terrain, tree cover, and how long ago the last survey was done. Lots with clear markers and recent surveys cost less; rural or irregularly shaped parcels cost more. The price stings, but it is a fraction of what a rebuild costs if the fence turns out to be two feet onto your neighbor’s land.
Old fence lines, hedgerows, and “where the mowing stops” are not reliable evidence of a boundary. Those features drift over time and have no legal standing. The survey is your proof that the fence sits where it belongs.
What Happens If the Fence Ends Up Over the Line
A fence that crosses onto a neighbor’s property, even by a few inches, creates legal exposure that gets worse the longer it sits. The immediate risk is a demand for removal. If a survey shows the fence is on their land, courts routinely order it moved and the encroaching party pays.
The longer-term risk is adverse possession. In every state, someone who openly occupies another person’s land for a continuous period, meets the statutory requirements, and acts as if they own it can eventually claim legal title to that strip. The required period varies by state, from as few as five years to twenty or more, and the clock starts the moment the fence goes up in the wrong place. If a neighbor’s fence has been three feet onto your property for fifteen years and you never objected, reclaiming that land can become a real fight.
Address encroachments as soon as you discover them. A polite conversation and a surveyor’s report resolve most of these situations. A decade of silence turns them into lawsuits.