A plumbing code sets standards and guidelines for the installation, maintenance, and repair of the systems installed in a building for the purpose of delivering water or gas, and for draining or exhausting the waste products created in their use. Plumbing codes are generally promulgated by state or provincial governments or regulatory authorities, although some countries establish national plumbing codes.
Plumbing codes set standards, sometimes very specific, for every element of a plumbing system, dictating the size and material of all supply lines, drainpipes, fittings, and fixtures, based on the population to be served or the size of the structure. It will sometimes identify prohibited materials. In the 1970s, newly developed polybutylene pipes were used for supply pipes; many of these pipes malfunctioned within the next two decades. The circumstances that led to the malfunctions have since been identified and addressed, but many local plumbing codes still prohibit polybutylene supply pipes. The different materials that can be used in installing, repairing, and maintaining plumbing systems are also specified in great detail in plumbing codes. As soon as lead-free solder became available, for instance, it became standard in plumbing codes and solder containing lead was outlawed.
There is no uniform way that plumbing codes are established and enforced. In the United States, most states set forth a plumbing code, generally adopting a model code, such as the Uniform Plumbing Code (UPC). After making whatever adjustments to the code they deem necessary, many states give municipalities within their jurisdiction the authority to impose stricter requirements. Most jurisdictions use the plumbing code to define all standards for all sorts of systems; other jurisdictions have codes addressing different aspects of plumbing. New York State, for instance, has a plumbing code, a boiler code, and a gas code.
When a jurisdiction adopts a plumbing code, it's generally not written from scratch. Instead, a model code like the UPC or the International Plumbing Code (IPC) is adopted in whole or in part, and modified by the legislature or regulating body as deemed appropriate. These model codes are developed by professionals in the field, and generally represent a professional consensus of “best practices” in plumbing.
Other nations operate similarly; some legislate a national plumbing code, with or without the option for localities to make modifications as deemed appropriate. Other countries leave the establishment and enforcement of plumbing codes to their provincial or municipal authorities.
Plumbing practices are continuously evolving. The first water supply pipes, built during many centuries BC, were made of lead, a practice which was discouraged by the first century AD but continued worldwide until the 19th and 20th centuries. The existence of model codes serves as a clearinghouse of relevant plumbing information for regulators and legislators, and as the model codes are updated, the legislation and regulations based on them can also be upgraded.
Plumbing systems installed in new or existing construction must conform to the existing code, which in the US is the state code as modified by local ordinance or regulation. Specific information about the relevant code can be obtained when obtaining the permit to perform the plumbing work. The permit, legally required, is generally obtained from a special department, often called a buildings department, of a local government.