For 1,300 years, a single exam determined who could govern China. The Keju system was the world's first merit-based civil service — and its legacy shapes Chinese society to this day.
In 605 CE, Emperor Yang of the Sui Dynasty made a decision that would shape Chinese civilization for the next 1,300 years: he established a system of written examinations to select government officials. Before this, government positions were inherited by aristocratic families. After this, any man — regardless of birth — could theoretically rise to the highest levels of government by passing an exam. The Imperial Examination System (科举制度, Kējǔ Zhìdù) was the world's first meritocracy, and it ran China until 1905.
The examination system had multiple levels, each more difficult than the last. The county-level exam (童试) was the entry point — passing made you a 'licentiate' (秀才, xiùcai). The provincial exam (乡试) was held every three years; passing made you a 'recommended man' (举人, jǔrén). The metropolitan exam (会试) in Beijing was the penultimate level. The final exam (殿试) was held in the imperial palace, presided over by the emperor himself. The top scorer — the Zhuangyuan (状元) — became a national celebrity.
The examination tested mastery of the Confucian classics — the Four Books and Five Classics — a body of text totaling approximately 430,000 characters. Candidates were expected to memorize these texts completely and to compose essays in a rigid format called the 'eight-legged essay' (八股文, bāgǔwén). The essay had eight sections of prescribed length and structure, and had to demonstrate mastery of classical Chinese prose style. Preparation typically required 10–20 years of study.
The provincial and metropolitan examinations were held in examination compounds containing thousands of individual cells — stone cubicles approximately 1.2 meters wide and 1.5 meters deep. Candidates entered their cell with their writing materials, food, and bedding, and were locked in for three days. They ate, slept, and wrote in this space. The cells were searched for hidden texts before entry. Guards patrolled constantly. Cheating was punishable by death — and yet elaborate cheating methods were developed, including texts written on underwear in microscopic characters.
"The examination system was simultaneously the most democratic and the most oppressive institution in Chinese history. It gave every man the theoretical possibility of advancement, while consuming the lives of millions in preparation for an exam that most would fail dozens of times." — Professor Wang Mingming, Peking University
The examination system profoundly shaped Chinese society. It created a class of scholar-officials (士大夫, shìdàfū) who were simultaneously intellectuals, administrators, and cultural arbiters. It spread literacy and Confucian values throughout the empire. It created a unified written language that transcended regional dialects. It also created a culture of intense educational pressure — the belief that success comes through study and examination — that persists in Chinese society today. The modern Gaokao (高考) university entrance examination is the direct descendant of the Keju system.
The Imperial Examination System was abolished in 1905, during the final years of the Qing Dynasty. The reasons were multiple: the system tested classical knowledge but not the practical skills needed to modernize China; it had become increasingly corrupt; and Western-educated reformers argued that China needed engineers, scientists, and diplomats, not classical scholars. The abolition was traumatic — it eliminated the only path to advancement that millions of families had invested in for generations.
The Jiangnan Gongyuan (江南贡院) in Nanjing is China's largest surviving imperial examination complex, with over 20,000 individual examination cells. It is now a museum dedicated to the examination system. The Confucius Temple (夫子庙) adjacent to it was where candidates prayed before their exams. In Beijing, the Imperial Academy (国子监) and the Confucius Temple contain stone tablets inscribed with the names of successful candidates — a 700-year record of China's meritocracy.