Tofu has a long history of existence and is said to have been invented in 164 BC by Liu An, the grandson of Liu Bang, the Gaozu Emperor of Han Dynasty - King of Huainan in China. Liu An invented tofu by accidentally dotting soybean juice with gypsum while burning medicines and making elixirs on Bagong Mountain, on the border between Shouxian and Huainan in Anhui Province. Yuan Hanqing thought that tofu came into existence only in the Five Dynasties.
Japanese scholars Shinoda Tohru based on the fifth generation Tao Gu Qingyilu "for the Qingyang Chancellor, clean and diligent people, meat flavor does not give, the day the city of bean curd a few", that the origin of tofu in the late Tang Dynasty.