In the spring of 1872, Andersen fell out of his bed and was severely hurt; he never recovered. Soon afterward, he started to show signs of liver cancer.
He died on 4 August 1875, in a house called Rolighed (literally: calmness), near Copenhagen, the home of his close friends, the banker Moritz Melchior and his wife. Shortly before his death, Andersen had consulted a composer about the music for his funeral, saying: "Most of the people who will walk after me will be children, so make the beat keep time with little steps." His body was interred in the Assistens Kirkegård in the Nørrebro area of Copenhagen.
At the time of his death, Andersen was internationally revered, and the Danish Government paid him an annual stipend as a "national treasure".