He was born in Gongxian County in Henan Province, but spent much of his childhood in Luoyang. He journeyed to the Imperial capital of Chang'an in 746 in an attempt to secure a government post, but was unsuccessful, and ultimately had to flee the city in 755 when the An Lushan Rebellion broke out. Captured by the rebels nevertheless, he finally escaped in 757, and was permitted to enter the service of the Emperor. Only two years later, however, Du Fu resigned his post, and retired to Chengdu in Sichuan province, where he remained until his death in 770.
His poems, often in the eight-line form known as lu shi, often highlighted the sufferings of ordinary people, and injustices in society.