The Three Departments and Six Ministries () system was the primary administrative structure in imperial China from the Sui dynasty (581–618) to the Yuan dynasty (1271–1368). It was also used by Balhae (698–926) and Goryeo (918–1392), and various other states in Manchuria, Korea and Vietnam.

The Three Departments were three top-level administrative structures in imperial China. They were the Central Secretariat, responsible for drafting policy, the Chancellery, responsible for reviewing policy and advising the emperor, and the Department of State Affairs, responsible for implementing policy. The former two were loosely joined as the Secretariat-Chancellery during the late Tang dynasty, the Song dynasty, and Goryeo.

The Six Ministries were direct administrative organs of the state under the authority of the Department of State Affairs. They were the Ministries of Personnel, Rites, War, Justice, Works, and Revenue. During the Yuan dynasty, authority over the Six Ministries was transferred to the Central Secretariat.

The Three Departments were abolished by the Ming dynasty, but the Six Ministries continued under the Ming and Qing, as well as in Vietnam and Korea.

Three Departments and Six Ministries during the Tang dynasty

Early history Before the Three Departments and Six Ministries, the central administrative structure of the Qin and Han dynasties was the Three Lords and Nine Ministers (; sāngōng jiǔqīng) system. Nonetheless, even then, offices which fulfilled the same functions as the later three departments were already in existence.

The Department of State Affairs originated in the Qin dynasty (221–206 BC) in an archival capacity. During the reign of Emperor Wu of Han (), the department's office was instituted as a channel of communications between the Emperor's advisors and the government as a whole. By the Eastern Han dynasty (25–220), an office of advisors and reviewers had also been set up. Under the reign of Emperor Wen of Wei (), the Central Secretariat was formally created to draft imperial edicts and to balance out the powerful Department of State Affairs. The office of the Chancellery was first instituted during the Jin dynasty (226–420) and carried on throughout the Northern and Southern dynasties period (420–589), where it often became the most powerful office in the central government.

Three Departments

Department of State Affairs The Department of State Affairs (), also known as the Imperial Secretariat, was the primary executive institution of imperial China, head of the Six Ministries, the Nine Courts, and the Three Directorates (sometimes five). It existed in one form or another from the Han dynasty (202 BC – 220 AD) until the Yuan dynasty (1271–1368), but was never re-established in the following Ming dynasty.

The Department of State Affairs originated as one of the Six Chief Stewards () that were responsible for headgear, wardrobe, food, the bath, the bedchamber and for writing (, literally "presenting writings"), during the Qin dynasty. The position of chief steward for writing (shangshu) became more important during the reign of Emperor Wu of Han (), who tried to escape the influence of the grand chancellor and imperial secretary by relying on other officials. Emperor Guangwu of Han () created the Department of State Affairs with the shangshu as head of the six sections of government. It was headed by a director () and a vice director (), assisted by a left and right aide () and 36 attendant gentlemen (), six for each section, as well as 18 clerks (), three for each section. These six sections later became the Six Ministries, and their chief stewards, the director and vice director were collectively known as the eight executives (). The power of the Department of State Affairs decreased in the succeeding dynasties of Cao Wei (220–226) and Jin (266–420) as some of its functions and authority were delegated to the Central Secretariat and Chancellery. The posts of director and vice director also became less important as it was bestowed upon high ministers and noblemen who did not participate in the administrative activities of the department. Real paperwork became the purview of clerks, whose increasing influence frightened Emperor Wu of Liang (). Emperor Wu decreed that only nobility should become clerks, but none of the nobles were willing to assign their sons to such a lowly position. Members of the department refused to cooperate with Emperor Wu and resisted any changes to administration. The Department of State Affairs in the Sixteen Kingdoms and the Northern dynasties tended to work more similarly to the Southern dynasties over time but were dominated by nomadic peoples such as the Xianbei.

During the Sui dynasty (581–618), the post of director was often left vacant while two vice directors handled affairs.

During the Tang dynasty (618–907), the post of director continued to be left vacant for the most part, and when it was filled, it was by the heir apparent such as Li Shimin (r. 626–649) or Li Shi (r. 779–804). To weaken the power of the Vice Director, who was de facto head of the institution, the position was divided into left and right Vice Directors, with the former being the senior. At times the Vice Directors were comparable in power with the Grand Chancellor and sometimes even superseded him. However, by the mid-Tang period the Grand Chancellors had regained their predominance, and Vice Directors of the department were required to have special designations to participate in policy making discussions. Thereafter the department became a purely executive institution. The six sections of government were formally divided into the Six Ministries, each headed by a Minister (shangshu). The six divisions were replicated at the local prefectural level, and each directly reported to their respective ministries in the central government. In addition to the Six Ministries, the Department of State Affairs was also in charge of the Nine Courts and Three Directorates. The Department of State Affairs was one of the largest employers in the government and provided income and posts for many officials. The institution lasted until the Yuan dynasty (1271–1368) and was never re-established in the following Ming dynasty.

Six Ministries The Six Ministries (), also known as the "Six Boards", were government agencies directed by the Department of State Affairs and formally institutionalized during the Cao Wei and Jin dynasty (266–420) periods. Each ministry was headed by a Minister or Secretary ; who was assisted by two Vice-Ministers or Secretaries . Each ministry was divided into four bureaus () responsible for local administration, each headed by a director (), who was assisted by a vice director (). The Six Ministries structure was purely administrative. Sometimes they shared administrative duties with parallel structures such as the Three Bureaus and the Bureau of Military Affairs. The Yuan dynasty (1279–1368) transferred authority over the Six Ministries to the Central Secretariat. The succeeding Ming dynasty (1368–1644) abolished the Central Secretariat entirely and put the Six Ministries under the direct control of the emperor. In 1901 and 1906, the Qing dynasty (1644–1912) added new ministries to the structure, making the term "Six Ministries" obsolete.

The Ministry of Personnel or Civil Appointments () was in charge of assessments, appointments, promotions, and sanctions, pensions, and rewards of officials, as well as granting of honorific titles. The Ministry of Revenue or Finance () was in charge of gathering census data, collecting taxes and handling state revenues, while there were two offices of currency that were subordinate to it. The Ministry of Rites () was in charge of state ceremonies, rituals and sacrifices; it also oversaw registers for Buddhist and Daoist priesthoods and foreign affairs, as well as the final stage of Keju exams; it also dealt with China's foreign relations prior to the establishment of the Zongli Yamen in 1861. It also managed the imperial examinations. The Ministry of War or Defense () was in charge of the appointments, promotions and demotions of military officers, the maintenance of military installations, equipment and weapons, as well as the courier system. In times of war, high-ranking officials in the Ministry also served as strategists and advisers to frontline commanders. Sometimes, they even served as frontline commanders themselves. The Ministry of Justice or Punishments () was in charge of judicial and penal processes, but had no supervisory role over the Censorate or the Grand Court of Revision. The Ministry of Works or Public Works () was in charge of government construction projects, hiring of artisans and laborers for temporary service, manufacturing government equipment, the maintenance of roads and canals, standardisation of weights and measures, and the gathering of resources from the countryside.

Nine Courts The Nine Courts throughout most of history were: + The Nine Courts and Ministers Court Minister Court of Imperial Sacrifices () Minister of Ceremonies () Court of Imperial Entertainments () Minister of the Household () Court of the Imperial Clan ( or ) Minister of the Imperial Clan () Court of the Imperial Stud () Minister Coachman () Court of the Imperial Treasury () Minister Steward () Court of the Imperial Regalia () Minister of the Guards () Court of State Ceremonial () Minister Herald () Court of the National Granaries () Minister of Finance () Court of Judicature and Revision () Minister of Justice (

Three/Five Directorates The Three Directorates, or sometimes five, were originally the Directorates of Waterways, Imperial Manufactories, and Palace Buildings. In the Sui dynasty, the Directorate of Armaments or Palace Domestic Service was sometimes counted as one. The Sui and Tang dynasties also added the Directorate of Education to the list. The Directorate of Astronomy was added during the Song dynasty.

+ Three/Five Directorates Directorate Transliteration Chinese Directorate of Waterways Directorate for Imperial Manufactories Directorate for Palace Buildings Directorate for Armaments Directorate of Palace Domestic Service Directorate of Education Directorate of Astronomy

Central Secretariat The Central Secretariat (, ), also known as the Palace Secretariat or simply the Secretariat, was the main policy-formulating agency that was responsible for proposing and drafting all imperial decrees, but its actual function varied at different times.

The Central Secretariat originated during the reign of Emperor Wu of Han (r. 141-87 BC) to handle documents. The chief steward for writing (), aided by eunuch secretary-receptionists (), forwarded documents to the inner palace. This organization was headed by a Secretariat Director () assisted by a Vice Director (). These two posts came to assert significant political influence on the court, causing eunuchs to be forbidden from holding these posts by the end of the Western Han dynasty. This institution continued after the end of the Han dynasty into Cao Wei and it was Emperor Wen of Wei who formally created the Central Secretariat, headed by a Secretariat Supervisor () and a Director (). Although lower in rank than the Department of State Affairs, the personnel of the Central Secretariat worked closer to the emperor and were responsible for drafting edits, and therefore their content. Under the Wei, the Central Secretariat was also in charge of the palace library, but this responsibility was terminated during the Jin dynasty (266–420). In the Northern and Southern dynasties, the personnel ranged from princes and high ranking family members to professional writers. The position and responsibilities of the Central Secretariat varied greatly in this period, sometimes even being put in charge of judicial and entertainment matters.