A yamen (ya-men; simplified Chinese: ; traditional Chinese: ; pinyin: yámén; Wade–Giles: ya2-men2) was the administrative office and/or residence of a local bureaucrat or mandarin in imperial China. A yamen can also be any governmental office or body headed by a mandarin, at any level of government: the offices of one of the Six Ministries is a yamen, but so is a prefectural magistracy. The term has been widely used in China for centuries, but appeared in English during the Qing dynasty.
Within a local yamen, the bureaucrat administered the government business of the town or region. Typical responsibilities of the bureaucrat includes local finance, capital works, judging of civil and criminal cases, and issuing decrees and policies.
Typically, the bureaucrat and his immediate family would live in a residence attached to the yamen. This was especially so during the Qing dynasty, when imperial law forbade a person from taking government office in his native province.
Yamens varied greatly in size depending on the level of government they administered, and the seniority of the bureaucrat's office. However, a yamen at a local level typically had similar features: a front gate, a courtyard and a hall (typically serving as a court of law); offices, prison cells and store rooms; and residences for the bureaucrat, his family and his staff.
At the provincial level and above, specialisation among officials occurred to a greater extent. For example, the three chief officials of a province (simplified Chinese: 三大宪; traditional Chinese: 三大憲; pinyin: Sàn Dà Xiàn; literally: "the Three Great Laws") controlled the legislative and executive, the judicial, and the military affairs of the province or region. Their yamen would accordingly be specialised according to the functions of the office. The great yamens of the central government, located in the capital, are more exclusively office complexes.