Building codes are a set of rules and regulations that govern the design, construction, and maintenance of buildings. They are typically established by local or national governments and enforced by building officials or inspectors. The main purpose of building codes is to ensure that structures are safe, accessible, and environmentally sustainable.