Apocalyptic and post-apocalyptic fiction is a subgenre of science fiction, science fantasy or horror fiction literature in which the Earth's technological civilization is collapsing or has collapsed. The apocalypse event may be climatic, such as runaway climate change; natural, such as an impact event; man-made, such as nuclear warfare or resource depletion; medical, such as a Pandemic, whether natural or man-made; Eschatological such as the Last Judgement, Second Coming or Ragnarök; or imaginative, such as a zombie apocalypse, cybernetic revolt, technological singularity, dysgenics, or alien invasion. The story may involve attempts to prevent an apocalypse event, deal with the impact and consequences of the event itself, or it may be post-apocalyptic, set after the event. The time frame may be immediately after the catastrophe, focusing on the travails or psychology of survivors, the way to maintain the human race alive and together as one, or considerably later, often including the theme that the existence of pre-catastrophe civilization has been forgotten (or mythologized). Post-apocalyptic stories often take place in a non-technological future world, or a world where only scattered elements of society and technology remain.
Various ancient societies, including the Babylonian and Judaic, produced apocalyptic literature and mythology which dealt with the end of the world and of human society, such as the Epic of Gilgamesh, written c. 2000–1500 BC. And recognizable modern apocalyptic novels had existed since at least the first third of the 19th century, when Mary Shelley's The Last Man (1826) was published. However, this form of literature gained widespread popularity after World War II, when the possibility of global annihilation by nuclear weapons entered the public consciousness.