Nanhai Commandery (Chinese: 南海郡) was a Chinese commandery that existed from Qin dynasty to Tang dynasty. At the greatest extent, Nanhai's territories covered present-day Guangdong, Hainan, southeastern Guangxi and the southern tip of Fujian. The seat of Nanhai Commandery was Panyu (modern Guangzhou).
In 214 BC, Qin dynasty conquered Lingnan and established three commanderies, Nanhai, Guilin and Xiang within the region. After the collapse of Qin, Zhao Tuo, the Qin prefect of Longchuan County, Nanhai, established the Nanyue kingdom on Nanhai and surrounding commanderies. Panyu became the kingdom's capital.
In 112 BC, Nanyue was annexed by the Han dynasty. In late Western Han period, Nanhai had a population of 19,613 households (94,253 individuals). The commandery administered 6 counties: Panyu, Boluo (博羅), Zhongsu (中宿), Longchuan (龍川), Sihui (四會) and Jieyang (揭陽). During the Eastern Han period, a new county, Zengcheng, was created. By 140 AD, the population had grown to 71,477 households (250,282 individuals).
Jin dynasty unified the Three Kingdoms in 280. At the time, the commandery recorded a population of 9,500 households. Two new commanderies were split off from Nanhai during Eastern Jin: Dongguan (東官) in 330 and Xinhui (新會) in 420. In 464, the population in Nanhai was 8,574 households (49,157 individuals). The number of counties had been increased to 10. The commandery was abolished when the Sui dynasty conquered the Chen dynasty.
During Sui and Tang dynasties, Nanhai Commandery became an alternative name of Guang Prefecture. In 741, Nanhai administered 13 counties: Nanhai, Panyu, Zengcheng, Sihui, Huameng (化蒙), Huaiji, Jianshui (洊水), Dongguan, Qingyuan, Hankuang (浛洭), Zhenyang (湞陽), Xinhui, Yining (義寧). The population was 42,235 households (221,500 individuals).