In 1856 he passed the metropolitan-level imperial examination and was awarded the jinshi degree, and was admitted to the Hanlin Academy first with the scholastic title of Shujishi, years later as bianxiu, a compiler and secretary. In 1863, he was yushi, investigating censor; in this capacity he was the leader of more than 40 officials who successfully petitioned Empress Dowager Cixi to exonerate Prince Gong. Tan won his fame and drew positive attention from the leading politicians as well as the Empress. In 1866, he was appointed the Prefect of Hangzhou, Zhejiang Province. In 1868, recommended by Li Hongzhang, he was appointed the Judicial Commissioner of Henan Province. In 1871, recommended by Zuo Zongtang, Tan became the Provincial Administration Commissioner of Shaanxi; next year he was advanced to Officiating Lieutenant Governor, and later the Acting Governor of Shaanxi. In 1875, Tan was appointed Governor of Shaanxi mainly because of his contribution to the victory by supplying Zuo's army when it battled Muslim rebels in Xinjiang. Zuo and Tan became close friends and partners in implementing Manchu policy of suppressing Muslim rebellion in Northwest China. In 1879, Tan was appointed the Governor of Zhejiang, with extra rank of the Minister of Military Affairs. During his tenure in Zhejiang, he rebuilt the imperial Wenlan Library damaged by the Taiping Rebellion, and restored the housing of the recovered volumes of the collection of Siku quanshu. In 1881, Tan was appointed the Viceroy of Shaanxi and Gansu Provinces, worked hard to promote local agriculture and increased fiscal revenues. In 1883, he and :zh:刘锦棠|Liu Jintang submitted a memorial proposing the creation of the Province of Xinjiang in order to have better control of the region; the proposal was approved and the Province of Xinjiang was put under the administration of the Viceroy of Shaanxi and Gansu Provinces. In 1892, he was appointed the Viceroy of Zhejiang and Fujian Provinces, he reformed the Foochow Arsenal and improved its efficiency and production. In 1895, he was appointed the Viceroy of Guangdong and Guangxi Provinces. He suppressed the Canton uprising led by Sun Yat-sen and executed Lu Haodong of the Revolutionary Party. Tan reported to the throne against the Hundred Days' Reform, and it was highly appreciated by conservative Empress Dowager Cixi. In 1899, Tan resigned to live in Changsha of his home province as he opposed to Hong Kong's New Territories' Lease to the UK and the Guangzhouwan to France. He died of illness in 1905, but was awarded an honorary posthumous nameWen qin due to his loyalty and achievements.