|This article needs additional citations for verification. (November 2007) (Learn how and when to remove this template message)|
Sino–German relations were formally established in 1861, when Prussia and the Qing Empire concluded the first Sino-German treaty during the Eulenburg Expedition. Ten years later, the German Empire was founded and the new state inherited the old Prussian treaty. The relations were on the whole, frosty, with Germany joining imperialist powers like Great Britain and France in carving out spheres of influence in the Chinese empire.
The Germans also participated in the crushing of the Boxer Rebellion. After World War I, relations gradually improved, though this would gradually change during the 1930s as Adolf Hitler allied himself with Japan. During the aftermath of World War II Germany was split in two states: a liberal democratic West Germany and a communist East Germany. Cold War tensions led to West Germany's alliance with the United States against communism and thus allied against China. The Eastern part was allied through the Soviet Union with China. After the German reunification, relations between Germany and China gradually and vastly improved.
According to a 2014 BBC World Service Poll, 42% of Chinese people view Germany's influence positively, compared with 22% which view it negatively, while only 10% of Germans view China's influence positively, with 76% expressing a negative view, making Germany, along with Japan, the country with the largest Anti-Chinese sentiment in the world. 
Unlike Portugal or the Netherlands, German states were not involved, on the state level, in the early (16-17th centuries) contacts between Europe and China. Nonetheless, a number of individual Germans reached China at that time, in particular as Jesuit missionaries. Some of them played a significant role in China's history, as did Johann Adam Schall von Bell (in China in 1619-1666), who was in Beijing when it was taken by the Manchus in 1644, and soon became a trusted counselor of the early Qing leaders. Meanwhile, in Rome another German Jesuit, Athanasius Kircher, who never got to go to China himself, used reports of other Jesuits in China to compile China Illustrata, a work that was instrumental in popularizing knowledge about China among the 17th-century European readers.
The earliest Sino-German trading occurred overland through Siberia, and was subject to transit taxes by the Russian government. In order to make trading more profitable, German traders took the sea route and the first German merchant ships arrived in China, then under the Qing Dynasty, as part of the Royal Prussian Asian Trading Company of Emden, in the 1750s.
Early diplomatic relations
In 1859, following China's defeat in the Second Opium War, Prussia sent the Eulenburg Expedition to negotiate commercial treaties with China, Japan and Siam. On 2 September 1861, Friedrich Albrecht zu Eulenburg and a representative from the Zongli Yamen signed the Treaty of Tianjin, which opened formal commercial relations between China and Prussia, which represented the German Customs Union. Prussia would later on become the dominant and leading part of the newly founded German empire. The treaty would govern Sino-German relations until World War I, when the Republic of China repudiated the treaty unilaterally.
During the late 19th century, Sino-foreign trade was dominated by the British Empire, and Otto von Bismarck was eager to establish German footholds in China to balance the British dominance. In 1885, Bismarck had the Reichstag pass a steamship subsidy bill which offered direct service to China. In the same year, he sent the first German banking and industrial survey group to evaluate investment possibilities, which led to the establishment of the Deutsch-Asiatische Bank in 1890. Through these efforts Germany was second to Britain in trading and shipping in China by 1896.
In 1897, the German empire took advantage of the murder of two German missionaries to invade Qingdao and founded the Jiaozhou Bay colony. In 1900, Germany took part in the Eight-Nation Alliance that was sent to relieve the Siege of the International Legations in Beijing during the Boxer Uprising.
Sino-German cooperation (1911-1941)
Although intense cooperation lasted only from the Nazi takeover of Germany in 1933 to the start of the war with Imperial Japan in 1937, and concrete measures at industrial reform started in earnest only in 1936, it had a profound effect on Chinese modernization and capability to resist the Japanese in the war.
At the same time, the exile German Communist Otto Braun was in China as a Comintern agent, sent in 1934, to advise the Communist Party of China (CPC) on military strategy and taking a major part in The Long March under a Chinese name, Li De (Chinese: 李德; pinyin: Lǐ Dé); it was only many years later that Otto Braun and "Li De" came to be known as the same person.
World War II (1941–1945)
Division of Germany and the Cold War (1945-1991)
Reunification of Germany: friendly relations with China
The frequent high-level diplomatic visits are acknowledged to have helped guarantee the smooth development of Sino-German relations. From 1993 to 1998, German and Chinese leaders met face-to-face 52 times: Among those Chinese leaders who visited Germany were President Jiang Zemin; Qiao Shi, former Chairman of the Standing Committee of the National People’s Congress (NPC); and Li Peng, former Premier and Chairman of the NPC Standing. Meanwhile, German leaders who visited China included President Roman Herzog, Chancellor Helmut Kohl, Foreign Minister Klaus Kinkel and Minister of State at the German Federal Foreign Office Ludger Volmer. Among these leaders, Chancellor Kohl visited China twice in 1993 and 1995. Since the new German government came into power in October 1998, Chancellor Gerhard Schröder has paid three visits to China. One after another from Germany came Vice Prime Minister and Foreign Minister Joschka Fischer, Defense Minister Rudolf Scharping, and Minister of Economics and Technology Werner Müller. At the same time, Germany welcomed Chinese Primer Zhu Rongji, Foreign Minister Tang Jiaxuan, State Councilor Wu Yi, Member of the Political Bureau of the Chinese Communist Party Central Committee Wei Jianxing as well as Vice President Hu Jintao.
Relations would continue to improve after 1998. For instance, both Beijing and Berlin fervently opposed the invasion of Iraq in 2003, and in 2006 both Germany (the largest economy and the most populous country of the European Union) and China further enhanced their bilateral political, economic and diplomatic ties within the framework of Sino-EU strategic partnerships. Both Germany and China opposed direct military involvement in the 2011 Libyan civil war. Before the 2011 visit of China's PM Wen Jiabao, the Chinese government issued a "White Book on the accomplishments and perspective of Sino-German cooperation", the first of its kind for a European country. The visit also marked the first Sino-German government consultations, an exclusive mechanism for Sino-German communications.
China is Germany's second largest trading partner outside of the European Union, after the United States.
The trade volume between China and Germany surpassed 100 billion U.S. dollars in 2008. By 2014 German Chancellor Angela Merkel had visited China on trade missions seven times since assuming office in 2005, underlining the importance of China to the German economy.