Dying Earth is a subgenre of science fantasy or science fiction which takes place in the far future at either the end of life on Earth or the end of time, when the laws of the universe themselves fail. Themes of world-weariness, innocence (wounded or otherwise), idealism, entropy, (permanent) exhaustion/depletion of many or all resources (such as soil nutrients), and the hope of renewal dominate.
The Dying Earth genre differs from the apocalyptic subgenre in that it deals not with catastrophic destruction, but with entropic exhaustion of Earth. It is therefore described as more "melancholic". The genre was prefigured by the works of the Romantic movement. Jean-Baptiste Cousin de Grainville's Le Dernier Homme (1805) narrates the tale of Omegarus, the Last Man on Earth. It is a bleak vision of the future when Earth has become totally sterile. Lord Byron's poem "Darkness" (1816) shows Earth after the Sun has died. Mary Shelley's The Last Man (1826) details a future in which humanity is slowly but inexorably wiped from the face of the planet by an unstoppable outbreak of the Great Plague, killing almost everyone but the protagonist, immune to the disease's effects.
Another early example is La Fin du Monde (The End of the World, aka Omega: the last days of the world), written by Camille Flammarion and published in France in 1893. The first half of the novel deals with a comet on a collision course with Earth in the 25th century. The last half focuses on Earth's future history, where civilizations rise and fall, humans evolve, and finally Earth ends as an old, dying, and barren planet.
H. G. Wells's 1895 novella The Time Machine utilizes Dying Earth imagery. At the end of the novel, the unnamed time traveller travels thirty million years into the far future, where only gigantic crabs, butterflies and lichens exist on a barren Earth, then travels even further into the future to see the Sun go out and Earth freezing over.
Two brooding works by William Hope Hodgson would elaborate on Wells's vision. The House on the Borderland (1908) takes place in a house besieged by unearthly forces. The narrator then travels into a distant future in which humanity has died and then even further, past the death of Earth. Hodgson's The Night Land (1912) describes a time, millions of years in the future, when the Sun has gone dark. The last few millions of the human race are gathered together in a gigantic metal pyramid, the Last Redoubt, under siege from unknown forces and Powers outside in the dark.
A work by the early French science fiction author J.-H. Rosny aîné, La Mort de la Terre (1910), deals with the last, scattered generation of an evolved humankind on an exhausted, desert Earth and their encounter with a new type of mineral-metallic life. In some ways it reads like the inversion of his earlier Les Xipéhuz (1887), in which early humans encounter and battle an utterly alien and incomprehensible form of life.
From the 1930s onwards, Clark Ashton Smith wrote a series of stories situated in Zothique, the last continent of Earth, where its inhabitants live out their lives in a similar manner to the civilisations of the Classical era. Smith said in a letter to L. Sprague de Camp, dated November 3, 1953:
Zothique, vaguely suggested by Theosophic theories about past and future continents, is the last inhabited continent of earth. The continents of our present cycle have sunken, perhaps several times. Some have remained submerged; others have re-risen, partially, and re-arranged themselves. The science and machinery of our present civilization have long been forgotten, together with our present religions. But many gods are worshipped; and sorcery and demonism prevail again as in ancient days. Oars and sails alone are used by mariners. There are no fire-arms—only the bows, arrows, swords, javelins, etc. of antiquity.