Afghanistan – People's Republic of China relations were mostly warm and friendly during most of the 20th Century but after the Soviet invasion of Afghanistan in 1979 relations severely deteriorated. In the 21st century relations have improved significantly.
Throughout history, the relations between Afghanistan and China mostly involved trade of fruit and tea via caravans through Xinjiang and the Wakhan Corridor on the border between the two countries.
Premier Zhou Enlai and Vice Premier He Long visited Afghanistan in January 1957. This was the first ever visit taken by Chinese leadership to Afghanistan in the history of Sino-Afghan relations. During the visit, the Chinese Premier and Vice Premier met with King Mohammad Zahir Shah of Afghanistan, and held respective talks with Prime Minister Mohammad Daud Khan, Vice Prime Minister Ali Mohammad and Vice Prime Minister and Foreign Minister Mr. Mohammad Naim. The Chinese Premier's visit to Afghanistan enhanced mutual understanding between the two countries and laid a solid foundation for the development of friendly relations between China and Afghanistan. In October 1957, Prime Minister Mohammad Daud of Afghanistan visited China under China's invitation. During the visit he held meetings respectively with Chairman Mao Zedong, Vice Chairman Zhu De and Chairman Liu Shaoqi of the Standing Committee of the National People's Congress of China.
On November 22, 1963, China and Afghanistan signed in Beijing the Boundary Treaty between the People's Republic of China and the Kingdom of Afghanistan. This treaty settled the territorial dispute over the Afghan-controlled Wakhan on the border between Badakhshan Province in Afghanistan and the Xinjiang Uyghur Autonomous Region in China. The China-Afghanistan border is 92.45 kilometers long. 
December 27, 1979, Soviet troops were deployed in Afghanistan. On December 30, Chinese government made announcement condemning the Soviet military invasion, and refused to recognize the Soviet-backed Karmal government. The official relationship was stopped, and the Chinese embassy was degraded to representative office, and only dealt with consular and visa issues. 
After the fall of the Taliban regime after the United States intervention in 2001, relations between China and Afghanistan had greatly improved and were reestablished. In December 2001, China sent to Afghanistan a working team of the Ministry of Foreign Affairs, which attended the Afghan Interim Administration's foundation ceremony and sent a message of congratulations to President Hamid Karzai.
In January 2002, President Karzai visited China, and met respectively with Chinese President Jiang Zemin and Premier Zhu Rongji. The two sides exchanged the notes of China providing 30 million yuan of emergent material aid and US$1 million in cash to Afghanistan. President Jiang Zemin announced that China would provide US$150 million-worth of assistance to Afghanistan for its reconstruction. The 30 million yuan of emergent material aid had been delivered to Kabul by the end of March 2002. The Chinese Embassy in Afghanistan was reopened on February 6.
In May 2002, Chinese Foreign Minister Tang Jiaxuan visited Afghanistan. During the visit, the Chinese Foreign Minister met with Hamid Karzai, Chairman of the Interim Administration of Afghanistan and ex-King Zahir, and held talks with his counterpart Mr. Abdullah Abdullah. The two sides signed the Agreement on Economic and Technical Cooperation of US$30 million Chinese aid to Afghanistan. In November, Afghan Foreign Minister Abdullah Abdullah visited China. During his visit, the Chinese and Afghan sides exchanged the notes of China providing US$ 1 million of material aid to Afghanistan. In December, China, together with the other 5 neighboring countries of Afghanistan signed Kabul Declaration on Good Neighborly Relations, reaffirming its commitment to respect the sovereignty and territorial integrity of Afghanistan and to continuously support Afghanistan's peace process and reconstruction.
In February 2003, President Karzai passed through China twice. In May, the Vice President of Afghan Islamic Transitional Government Nematullah Sharhrani paid a working visit to China. During the visit he held talks with Chinese Vice President Zeng Qinghong and met with NPC Chairman Wu Bangguo and Premier Wen Jiabao. The two sides signed three cooperative documents including the Agreement of Economic and Technical Cooperation, under which the Chinese Government provides US$ 15 million grant to the Afghan Government.
Since 2010, China has increased its economics aid and investment in Afghanistan, notably with announcement by Metallurgical Corporation Of China(MCC) pledging $3.5 billion to develop Aynak Copper mines. China has the potential to make important contributions to Afghan stability. State-owned Chinese corporations are uniquely risk-tolerant and can help pave the way for future investments. The Chinese also enjoy a more positive relationship with Afghans, making their investments less likely to be targeted for attack by insurgents. These investments can stimulate economic growth that aid money alone cannot.
- International Boundary Study Afghanistan – China Boundary