A fence is a structure that encloses an area, typically outdoors, and is usually constructed from posts that are connected by boards, wire, rails or netting. A fence differs from a wall in not having a solid foundation along its whole length.
A balustrade or railing is a fence to prevent people from falling over an edge, most commonly found on a stairway, landing, or balcony. Railing systems and balustrades are also used along roofs, bridges, cliffs, pits, and bodies of water.
In most developed areas the use of fencing is regulated, variously in commercial, residential, and agricultural areas. Height, material, setback, and aesthetic issues are among the considerations subject to regulation.
The following types of areas or facilities often are required by law to be fenced in, for safety and security reasons:
Servitudes are legal arrangements of land use arising out of private agreements. Under the feudal system, most land in England was cultivated in common fields, where peasants were allocated strips of arable land that were used to support the needs of the local village or manor. By the sixteenth century the growth of population and prosperity provided incentives for landowners to use their land in more profitable ways, dispossessing the peasantry. Common fields were aggregated and enclosed by large and enterprising farmers—either through negotiation among one another or by lease from the landlord—to maximize the productivity of the available land and contain livestock. Fences redefined the means by which land is used, resulting in the modern law of servitudes.
In the United States, the earliest settlers claimed land by simply fencing it in. Later, as the American government formed, unsettled land became technically owned by the government and programs to register land ownership developed, usually making raw land available for low prices or for free, if the owner improved the property, including the construction of fences. However, the remaining vast tracts of unsettled land were often used as a commons, or, in the American West, "open range" as degradation of habitat developed due to overgrazing and a tragedy of the commons situation arose, common areas began to either be allocated to individual landowners via mechanisms such as the Homestead Act and Desert Land Act and fenced in, or, if kept in public hands, leased to individual users for limited purposes, with fences built to separate tracts of public and private land.
Ownership of a fence on a boundary varies. The last relevant original title deed(s) and a completed seller's property information form may document which side has to put up and has installed any fence respectively; the first using "T" marks/symbols (the side with the "T" denotes the owner); the latter by a ticked box to the best of the last owner's belief with no duty, as the conventionally agreed conveyancing process stresses, to make any detailed, protracted enquiry. Commonly the mesh or panelling is in mid-position. Otherwise it tends to be on non-owner's side so the fence owner might access the posts when repairs are needed but this is not a legal requirement. Where estate planners wish to entrench privacy a close-boarded fence or equivalent well-maintained hedge of a minimum height may be stipulated by deed. Beyond a standard height planning permission is necessary.
Where a rural fence or hedge has (or in some cases had) an adjacent ditch, the ditch is normally in the same ownership as the hedge or fence, with the ownership boundary being the edge of the ditch furthest from the fence or hedge. The principle of this rule is that an owner digging a boundary ditch will normally dig it up to the very edge of their land, and must then pile the spoil on their own side of the ditch to avoid trespassing on their neighbour. They may then erect a fence or hedge on the spoil, leaving the ditch on its far side. Exceptions exist in law, for example where a plot of land derives from subdivision of a larger one along the centre line of a previously-existing ditch or other feature, particularly where reinforced by historic parcel numbers with acreages beneath which were used to tally up a total for administrative units not to confirm the actual size of holdings, a rare instance where Ordnance Survey maps often provide more than circumstantial evidence namely as to which feature is to be considered the boundary.
On private land in the United Kingdom, it is the landowner's responsibility to fence their livestock in. Conversely, for common land, it is the surrounding landowners' duty to fence the common's livestock out such as in large parts of the New Forest. Large commons with livestock roaming have been greatly reduced by 18th and 19th century Acts for enclosure of commons covering most local units, with most remaining such land in the UK's National Parks.
Distinctly different land ownership and fencing patterns arose in the eastern and western United States. Original fence laws on the east coast were based on the British common law system, and rapidly increasing population quickly resulted in laws requiring livestock to be fenced in. In the west, land ownership patterns and policies reflected a strong influence of Spanish law and tradition, plus the vast land area involved made extensive fencing impractical until mandated by a growing population and conflicts between landowners. The "open range" tradition of requiring landowners to fence out unwanted livestock was dominant in most of the rural west until very late in the 20th century, and even today, a few isolated regions of the west still have open range statutes on the books. More recently, fences are generally constructed on the surveyed property line as precisely as possible. Today, across the nation, each state is free to develop its own laws regarding fences. In many cases for both rural and urban property owners, the laws were designed to require adjacent landowners to share the responsibility for maintaining a common boundary fenceline. Today, however, only 22 states have retained that provision.
Some U.S. states, including Texas, Illinois, Missouri, and North Carolina, have enacted laws establishing that purple paint markings on fences (or trees) are the legal equivalent of "No Trespassing" signs. The laws are meant to spare landowners, particularly in rural areas, from having to continually replace printed signs that often end up being stolen or obliterated by the elements. 
The value of fences and the metaphorical significance of a fence, both positive and negative, has been extensively utilized throughout western culture. A few examples include:
|Wikimedia Commons has media related to Fences.|
|Look up fence in Wiktionary, the free dictionary.|
|Wikiquote has quotations related to Fence.|
Media related to Fences at Wikimedia Commons