Langya Commandery (Chinese: 琅邪郡, 琅琊郡) was a commandery in historical China from Qin dynasty to Tang dynasty, located in present-day southeast Shandong and northeast Jiangsu.
The commandery was established in Qin dynasty on the former territories of Qi. From Qin to early Han dynasty, parts of Langya were separated to form three new commanderies, Jiaodong, Chengyang and Jiaoxi.
From 181 BC to 180 BC, Langya briefly served as the fief of Liu Ze (劉澤), who became the king of Yan after the Lü Clan Disturbance. Later, the commandery's borders gradually expanded as marquessates split from nearby kingdoms were added to the commandery. In late Western Han, Langya covered 51 counties and marquessates, by far the most numerous among all commanderies. After the establishment of Eastern Han, Chengyang was merged into Langya. In 41 AD, the territory was converted to a kingdom/principality and granted to Liu Jing (劉京), son of the Emperor Guangwu. Jing's descendants held the kingdom until 217 AD, when the last prince of the lineage was killed by Cao Cao and Langya was converted back to a commandery. In 140, Langya administered 13 counties, namely Kaiyang (開陽), Dongwu (東武), Langya (琅邪), Dongguan (東莞), Xihai (西海), Zhu (諸), Ju (莒), Dong'an (東安), Yangdu (陽都), Linyi (臨沂), Jiqiu (即丘), Zeng (繒), and Gumu (姑幕). The population was 570,967.
In 198, four counties (Ju, Gumu, Zhu, Dongwu) were transferred to the reestablished Chengyang Commandery. In 280, another commandery, Dongguan was separated from Langya. After the establishment of Western Jin, Langya became the fief of Sima Zhou, the fourth son of Sima Yi. After the death of Zhou, Langya passed to his son Jin (覲), and then to Jin's son Rui, the future Emperor Yuan of Jin. In 280, Langya had a population of 29,500 households.
Multiple new commanderies were established over the Sixteen Kingdoms and Northern Dynasties periods. In Northern Wei, Langya Commandery only administered 2 counties: Jiqiu and Fei (費). It was eventually abolished in early Sui dynasty.
In Sui and Tang dynasties, Langya Commandery became the alternative name of Yi Prefecture. In 742, the commandery's territory covered 5 counties: Linyi, Fei, Cheng (丞), Yishui (沂水) and Xintai (新泰). The population was 195,737, in 33,510 households.