Linfen is a prefecture-level city in the southwest of Shanxi province, China, bordering Shaanxi province to the west. It is situated along the banks of the Fen River. It has an area of and according to the 2020 Census, a population of 3,976,481 inhabitants of which 959,198 live in the built-up (or metro) area made up of Yaodu urban district. The GDP of Linfen ranked second in Shanxi Province. It was known as Pingyang () during the Spring and Autumn period. In 2006, the American Blacksmith Institute listed Linfen as one of the ten most polluted cities in the world.
Prior to 1978, Linfen was famous for its spring water, greenery and rich agriculture and therefore nicknamed "The Modern Fruit and Flower Town". Since then it has been developing into a main industrial center for coal mining, which has significantly damaged the city's environment, air quality, farming, health and its previous status as a green village.
Linfen is named for the Fen River. Its former names include Jin, Jinzhou, and Pingyang ().
Chinese archeologists have claimed that legendary ruler Yao's capital was located in Linfen, a confirmation of local legend responsible for the name of the city's Yaodu District. So, Linfen city is the earliest capital of China.
The area was the center of the marchland and duchy of Jin, named for the Jin River (). The duchy collapsed in the 4th century BC but gave its name to a Chinese princely title used as the dynastic name of the Sima clan. Jin Prefecture was centered on the town, which took its name as Jin and Jinzhou. Later, it was renamed Pingyang Commandery, which was also adapted as the name for its chief town. The Xiongnu emperor of Former Zhao Liu Cong made Pingyang his residence in the fourth century. "He kept court at Pingyang in [Shanxi] and ruled over central and southern [Shanxi], over [Shaanxi] (except for the Han basin), northern [Henan] (except for Kaifeng), southern [Hebei], and northern [Shandong]." In the 10th century, the city's walls were considered "fortified beyond approach".