Skip to main content
CityRuleLookup
Fences

Pennsylvania Fence Height and Property Boundary Rules by City: The PA Legal Fence Tradition

By CityRuleLookup Editorial Team

Fence law in Pennsylvania is one of the most fragmented and historically deep in the country. The General Assembly has never preempted residential fence height, the way a handful of Western states have preempted ADUs or solar panels. What it has done is leave on the books a livestock-era legal-fence statute (3 Pa. C.S.A. Section 951), build an entire body of common law around spite fences and boundary disputes, and pass a Uniform Planned Community Act (68 Pa. C.S. Section 5101 and following) that gives planned-community HOAs enormous leeway to regulate fences regardless of what the local borough or township allows. Underneath all of that, every Pennsylvania municipality writes its own zoning code, and the fence section of that code is where your six-foot board-on-board privacy fence actually lives or dies. This guide walks through the historical statute, the case law on spite fences and adverse possession, the HOA preemption framework, and nine concrete city profiles with the actual code chapters and sections you will cite when you apply for a permit.

Pennsylvania's oldest fence statute is not a zoning rule at all. Title 3 of the Pennsylvania Consolidated Statutes governs agriculture, and Chapter 9 of that title is the Domestic Animals Act. Section 951 sets out what counts as a "legal fence" for purposes of running livestock in rural townships. The statutory specification has its roots in 19th-century Pennsylvania farm practice: a legal fence must be at least four and one-half feet high and constructed of "five rails or boards, or post and wire," or any equivalent design that "will prevent the trespass of cattle." Section 952 makes the owner of livestock liable for damage if the animals break through a legal fence, and Section 953 sets up a township fence-viewer process for resolving disputes between adjoining landowners about who built what and who pays for repairs.

Section 951 is still on the books in 2026, and it still matters for farm operators in Pennsylvania's rural counties — the rules on who pays for a boundary fence between two grazing parcels run through the fence-viewer procedure in Section 953. What Section 951 does not do is reach a suburban backyard. The four-and-a-half-foot legal-fence height is a livestock-restraining minimum, not a residential maximum. A homeowner who cites Section 951 to argue that the township cannot cap a privacy fence at six feet will be told, correctly, that the statute applies to agricultural fences and that residential height limits are a matter of local zoning under the Pennsylvania Municipalities Planning Code (53 P.S. Section 10101 and following).

The historical residue still matters where agricultural parcels and residential parcels share a boundary: the legal-fence definition from Section 951 is the baseline for resolving who is responsible for the livestock-restraining fence, and that obligation can be enforced against a suburban neighbor who borders an active farm. Pennsylvania's broader fence common law — spite fences, partition fences, fence-viewer disputes — grew up around the legal-fence statute and still references it in modern opinions.

No statewide residential fence preemption

Outside the agricultural statute, Pennsylvania has no statewide cap on residential fence height, no statewide setback rule, no statewide material restriction, and no statewide rule on which side a fence's "finished" face must point. The Municipalities Planning Code at 53 P.S. Section 10603 gives every borough, township, and city authority to adopt a zoning ordinance regulating "the height, area, bulk, and use of buildings" and structures, and the consistent appellate reading has been that fences are accessory structures subject to that grant.

The practical result is that the legal fence on your lot is whatever the local zoning code says it is, modified by whatever HOA covenant applies, subject to a thin layer of state common law (spite fences, adverse possession, partition fences) and the building-code requirement for pool barriers. Across the state's more than 2,500 municipal governments the rules diverge significantly — Philadelphia and Pittsburgh have detailed urban fence codes, mid-sized cities like Erie and Reading use shorter zoning chapters, and small townships often have a few sentences in the general accessory-structure section.

The spite fence doctrine: Pile v. Pedrick and what survives

Pennsylvania is one of the states that recognizes a common-law cause of action for a "spite fence." The doctrine traces to Pile v. Pedrick, 167 Pa. 296 (1895), in which the Pennsylvania Supreme Court addressed a Philadelphia row-house dispute over a brick wall built directly on the boundary line that blocked light to the neighbor's windows. The court held that a property owner who erects a structure for the sole or dominant purpose of injuring a neighbor — with no legitimate use of his own land — can be enjoined and made liable for damages. The doctrine has been refined in later opinions but has never been overruled.

Modern Pennsylvania spite-fence cases turn on motive and utility. A six-foot privacy fence on a property line that incidentally blocks a neighbor's view is not actionable. A 12-foot solid wall built two inches off the boundary line, painted black on the neighbor-facing side, with no use to the building owner and documented hostility between the parties, is the textbook fact pattern that supports a spite-fence injunction. The analysis asks whether the structure (a) serves a legitimate purpose of the builder, and (b) was erected with malice or with the dominant purpose of harming the neighbor. If both prongs cut against the builder, a Pennsylvania court of common pleas can order the fence removed or reduced. In most of the state a spite-fence dispute lands in the Court of Common Pleas as an equitable action seeking an injunction; Philadelphia's Property Maintenance Code nuisance procedures can also be invoked against extreme cases.

Adverse possession and 21-year boundary fences

Pennsylvania's adverse possession statute is one of the longest holding periods in the country. Under 42 Pa. C.S. Section 5530, the statute of limitations for an action to recover real property is 21 years, and a person who has been in actual, continuous, exclusive, visible, notorious, distinct, and hostile possession of land for that period acquires title by adverse possession. A misplaced fence is one of the most common ways adverse possession ripens.

If you fence in two feet of your neighbor's land and use it as your own for 21 years, with the fence visible and your possession exclusive, you can quiet title to that strip even though the recorded deed says otherwise. The leading Pennsylvania case is Glenn v. Shuey, 407 Pa. Super. 213 (1991), which lays out the seven-element test. A 2019 statutory amendment added a 10-year shortened period for parcels of one-half acre or less with a single-family dwelling, codified at 42 Pa. C.S. Section 5527.1, but the 21-year default still applies to most parcels.

The practical implication is straightforward: never build a fence inside your neighbor's lot line "just to be safe," and never accept a fence built inside your lot line by a neighbor without documenting the boundary in writing. Pennsylvania also recognizes the doctrine of acquiescence — adjoining owners who treat a fence as the boundary for an extended period may be estopped from later disputing it (Plott v. Cole, 377 Pa. Super. 585 (1988)). A survey before installation is the single most useful expenditure in any Pennsylvania boundary-fence project.

Partition fences and cost-sharing

Pennsylvania never enacted a statewide partition-fence cost-sharing statute the way Iowa, Indiana, and several Midwestern states did in the 19th century. The closest analog is the fence-viewer procedure in 3 Pa. C.S.A. Section 953, which applies only to agricultural fences. Outside that narrow context, two suburban neighbors with no HOA have no automatic right to compel each other to share fence costs. If you build the fence, you pay for it.

That said, a fence built directly on a boundary line creates rights and obligations on both sides. Each owner may use his side of the fence (for painting, attaching items, planting against), and neither owner may unilaterally remove or significantly alter the fence without consent. Some Pennsylvania municipalities (including Pittsburgh and a handful of suburban townships) have written boundary-fence provisions into their zoning codes that require notice to the adjoining owner before installation, but none of those provisions force cost-sharing.

Easements and encroachments

Utility and shared-driveway easements regularly conflict with proposed fence lines. Most recorded easements prohibit permanent structures within the easement area, and a fence — even chain-link — counts as a permanent structure under most utility interpretations. If your back lot line is subject to a 15-foot utility easement, the utility has a contractual right to demand removal of any fence within that strip. The fence is often tolerated until the next maintenance event, at which point it is cut, removed, or both, with no compensation to the homeowner.

Solar-access easements were added to Pennsylvania law by Act 213 of 1978 (codified at 68 P.S. Section 700.301 and following), which allows recorded solar easements to be enforced like other recorded property interests. A fence that shades a neighbor's existing solar-access easement can be enjoined under the statute.

HOA preemption: 68 Pa. C.S. Section 5101 and the UPCA

The Pennsylvania Uniform Planned Community Act (68 Pa. C.S. Section 5101 and following), enacted in 1996, governs almost every planned community created after February 2, 1997. Section 5105 confirms the validity of recorded declarations and the right of HOAs to enforce architectural restrictions, including fence restrictions, against unit owners. Pennsylvania did not adopt the kind of statutory preemption that California Civil Code Section 4751 created for ADUs. An HOA in a Pennsylvania planned community can lawfully prohibit chain-link, require board approval of materials and color, cap height below the local zoning limit, and require periodic inspection — all by recorded declaration. The Uniform Condominium Act at 68 Pa. C.S. Section 3101 and following applies a parallel framework to condos, where the common-element status of perimeter fencing typically means individual owners cannot install fences without board approval.

Pennsylvania did enact some protective limits. Section 5219 (after the 2018 amendments) gives unit owners the right to display the American flag, and Section 5219.1 protects political signs during the 30-day pre-election window. Neither opens up fence rights. If you are buying into a Pennsylvania planned community, read the declaration's architectural standards section before assuming the local zoning code controls — the HOA layer is often more restrictive than the borough or township.

Pool barriers: the adopted IRC

Pennsylvania's Uniform Construction Code at 35 P.S. Section 7210.101 and following adopted the International Residential Code, including Appendix G (Swimming Pools, Spas, and Hot Tubs), as the statewide construction baseline. Under Section R325 of the IRC as adopted, residential pools deeper than 24 inches require a barrier at least 48 inches high with no openings large enough for a four-inch sphere, gates self-closing and self-latching with the latch at least 54 inches above grade, and a maximum 1.75-inch ground-to-fence-bottom clearance on a solid surface (2 inches on grass or dirt).

The pool barrier is independent of the property-line fence. A six-foot perimeter privacy fence often satisfies the IRC requirement if there is no direct house-to-pool access, but if the house wall forms part of the enclosure, every door from the house to the pool area must have an alarm or self-closing, self-latching gate per Section R325.2.9. The Department of Labor and Industry enforces the UCC where municipalities have not opted to enforce locally; most populous Pennsylvania cities handle their own pool-barrier inspections.

Corner visibility and sight triangles

Almost every Pennsylvania zoning code includes a sight-distance or clear-sight triangle at street intersections. The typical specification is a 25-foot by 25-foot triangle measured along the curb lines or property lines from the corner, inside which no fence, hedge, wall, or sign higher than 30 inches is permitted. The exact dimensions vary — Pittsburgh uses a 15-foot triangle in some districts, Philadelphia uses a 10-foot triangle for residential corners, and many suburban townships use 40-foot triangles on collector and arterial intersections. The sight triangle is the most common reason a permitted six-foot fence ends up tagged with a code violation after installation.

City profiles

Philadelphia.

The Philadelphia Zoning Code is Title 14 of the Philadelphia Code, comprehensively rewritten in 2012. Fences are regulated principally under Section 14-706 (Fences, Walls, and Other Structures Limiting Visibility). In residential RSA, RSD, and RM districts the maximum height in a front yard is four feet and in a side or rear yard six feet. Open-mesh fencing (chain-link, ornamental iron) may be approved at greater heights for specific lot configurations; barbed wire is prohibited in all residential zones and razor wire citywide except in industrial districts with a special exception under Section 14-705. The Philadelphia Historical Commission separately reviews fence proposals in designated historic districts under Title 14 Chapter 14-1000, and approval is not guaranteed even when the underlying zoning would allow the proposed fence. Permits are issued by the Department of Licenses and Inspections, and any fence over six feet requires a building permit and engineered drawings.

Pittsburgh.

Title 9 of the Pittsburgh Code is the Zoning Code, and Chapter 925 covers Fences and Retaining Walls. Section 925.02 sets the residential height schedule: four feet maximum in any required front yard, six feet maximum in side and rear yards. Open ornamental fencing such as wrought iron may extend to a maximum of six feet in front yards in some R1 and R2 districts under Section 925.02.B. Section 925.05 requires the finished side of a fence to face outward toward the adjoining property or street, which is one of the few Pennsylvania municipalities to codify that "good neighbor" rule. Section 925.04 prohibits barbed wire, razor wire, and electrified fences in all residential districts. The city's Department of Permits, Licenses, and Inspections issues fence permits and enforces the corner-clearance triangle in Section 925.03, which sets a 15-foot triangle at residential corner lots and a 25-foot triangle at intersections involving collector or arterial streets.

Allentown.

The Allentown Zoning Ordinance (Chapter 640 of the Codified Ordinances) regulates fences under Section 640.78. In all residential districts, fences in front yards may not exceed four feet, and fences in side and rear yards may not exceed six feet. Barbed wire and electric fencing are prohibited in residential zones, and Section 640.78.E requires the finished side of any fence to face the adjoining property. Allentown's accessory-structure provisions in Section 640.61 require a zoning permit for any fence exceeding 30 inches in height. The city enforces a 25-foot sight-distance triangle at corner lots under Section 640.45.

Erie.

Erie's Zoning Ordinance (Chapter 202 of the Codified Ordinances) handles fences in Section 202.34. Residential fence heights follow the standard pattern — four feet in front yards, six feet in side and rear yards — with chain-link permitted in all residential districts subject to the height limits. Section 202.34.D prohibits barbed wire and electrified fencing in residential zones. Erie's location on the Lake Erie shore brings an additional layer: lakefront parcels within the Coastal Zone Management area are subject to Pennsylvania Coastal Resources Management Program review for any shoreline structures, and a fence on a bluff-top lot may be reviewed for visual-impact and erosion considerations.

Reading.

Reading's Zoning Ordinance (Part 27 of the Codified Ordinances) regulates fences in Section 27-808. Residential height limits are four feet in front yards and six feet in side and rear yards. Section 27-808.3 imposes a 25-foot sight-distance triangle at corner lots and prohibits barbed wire, razor wire, and electric fencing in all residential and most commercial zones. Reading's older row-house neighborhoods carry additional architectural-review obligations in designated historic districts, and the Historical Architectural Review Board can require changes to proposed fence materials and colors before a permit is issued by the Department of Community Development.

Scranton.

The Scranton Zoning Ordinance (Chapter 445 of the Codified Ordinances) regulates fences in Section 445-49. Front-yard fences may not exceed four feet; side and rear fences six feet. Section 445-49.D prohibits barbed wire, razor wire, and electrified fences in residential zones. The Department of Licensing, Inspections, and Permits issues fence permits and enforces a 25-foot sight triangle at corner lots. PennDOT separately maintains the right to require removal of fences within state-route rights-of-way under 67 Pa. Code Section 441.

Bethlehem.

Bethlehem's Zoning Ordinance is Article 1300 of the Codified Ordinances, and fences are regulated under Section 1316.04. The height schedule is the Pennsylvania default: four feet front, six feet side and rear in residential districts. Section 1316.04.D requires that the finished side of any fence face outward toward the adjoining property or street, and Section 1316.04.E prohibits barbed wire and electric fencing in residential zones. Bethlehem's substantial historic district (the city is home to the Moravian-founded historic core listed on the National Register) brings additional review by the Historic and Architectural Review Board for any fence on a contributing property under Article 1302.

Lancaster.

The Lancaster City Zoning Ordinance (Chapter 300 of the Codified Ordinances) addresses fences in Section 300-79. Residential fence height limits are four feet in front yards and six feet in side and rear yards. Section 300-79.C prohibits barbed wire, razor wire, and electric fencing in all residential zones, and Section 300-79.B requires the structurally finished side to face outward. Lancaster's Historic Commission reviews fence proposals in the city's historic districts and on contributing structures, often requiring period-appropriate materials such as wrought iron or wood picket in lieu of vinyl or chain-link.

Harrisburg.

The Harrisburg Zoning Code is Title 7 of the Codified Ordinances; fences are regulated under Section 7-303.13. Residential fences may not exceed four feet in front yards or six feet in side and rear yards, and Section 7-303.13.D prohibits barbed wire, razor wire, and electric fencing. The City Planning Bureau issues permits for any fence over 30 inches and enforces a 25-foot sight triangle at corner lots. As Pennsylvania's capital, Harrisburg has overlapping state and city jurisdiction in the Capitol Complex area, where fence projects may require Pennsylvania Department of General Services review.

Snow fences and the Pennsylvania winter context

Snow fences are a Pennsylvania winter staple, especially in the western and northeastern parts of the state where lake-effect and orographic snowfall pile drifts across rural roads. PennDOT regulations at 67 Pa. Code Section 441.4 permit installation of snow fences within highway rights-of-way subject to a Highway Occupancy Permit, and most municipalities exempt seasonal snow fences from standard residential permit requirements if installed October to April and removed otherwise. Permanent snow fences are treated as agricultural fences in rural townships and as accessory structures elsewhere.

Common pitfalls

Six recurring issues tank Pennsylvania fence projects. First, the boundary survey. A 21-year adverse possession period and an active doctrine of acquiescence mean that a misplaced fence in Pennsylvania carries unusually high long-term stakes. Get a survey before you build. Second, the HOA layer. The Uniform Planned Community Act gives planned-community HOAs broad authority over fence design, height, materials, and color, and the recorded declaration controls regardless of what the local zoning code allows. Third, the historic district overlay. Philadelphia, Pittsburgh, Bethlehem, Lancaster, and dozens of smaller Pennsylvania municipalities maintain locally designated historic districts with separate architectural review boards, and the review process can require material and color changes even when the underlying zoning approves the proposed fence. Fourth, sight triangles. The 25-foot corner triangle is the single most common source of post-installation code violations on legal-height fences. Fifth, utility easements. The 15-foot rear-lot utility easement that runs along most Pennsylvania suburban subdivisions is the second most common source — utilities will allow a fence until the next maintenance event, at which point removal is at the homeowner's expense. Sixth, the pool barrier. The IRC pool-barrier requirement under R325 is independent of the perimeter privacy fence, and a six-foot perimeter fence with a direct house-to-pool door without an alarm or self-closing gate does not satisfy the code.

How to check your city

Pennsylvania does not preempt local fence rules, which means the binding answer for your lot is whatever the local zoning code says, modified by the HOA declaration if one applies, subject to common-law spite-fence and adverse-possession doctrines, and constrained by the IRC pool-barrier rule if you have a pool. Before you hire a contractor, answer six questions. What is my municipality's height limit in the front yard versus the side and rear? Is there a sight-distance triangle at my corner, and what dimensions? Is my property in a designated historic district subject to architectural review? Am I in a planned community governed by an HOA declaration? Are there recorded easements crossing the proposed fence line? Do I need a pool barrier complying with IRC Section R325? CityRuleLookup maintains a fences page for every Pennsylvania city and county we cover, pulling together the local code citation, height limits, material restrictions, permit contacts, and HOA preemption notes. Start there, then confirm with the city zoning office and, if a boundary or HOA dispute is in play, a Pennsylvania real-estate attorney familiar with the Municipalities Planning Code and the Uniform Planned Community Act.