How do building codes work?
Building codes are established by local authorities to set out minimum public-safety standards for building design, construction, quality, use and occupancy, location and maintenance. There are specialized codes for plumbing, electrical and fire, which usually involve separate inspections and inspectors.
All buildings must be issued a building permit and a certificate of occupancy before it can be used. During construction, housing inspectors must make checks at key points. Codes are usually enforced by denying permits, occupancy certificates and by imposing fines.
Building codes also cover most remodeling projects. If you are buying a house that has been significantly remodeled, ask for proof of the permits involved before you purchase to avoid future liability for fines.