Time travel is a common theme in fiction and has been depicted in a variety of media, such as literature, television, film, and advertisements.
The concept of time travel by mechanical means was popularized in H. G. Wells' 1895 story, The Time Machine. In general, time travel stories focus on the consequences of traveling into the past or the future. The central premise for these stories oftentimes involves changing history, either intentionally or by accident, and the ways by which altering the past changes the future and creates an altered present or future for the time traveler when they return home. Some stories focus solely on the paradoxes and alternate timelines that come with time travel, rather than time traveling itself. They often provide some sort of social commentary, as time travel provides a "necessary distancing effect" that allows science fiction to address contemporary issues in metaphorical ways.
Time travel in modern fiction is sometimes achieved by space and time warps, stemming from the scientific theory of general relativity.Stories from antiquity often featured time travel into the future through a time slip brought on by traveling or sleeping, or in other cases, time travel into the past through supernatural means, for example brought on by angels or spirits.
The idea of changing the past is logically contradictory, and results in a grandfather paradox.Paul J. Nahin, who has written extensively on the topic of time travel in fiction, states that "[e]ven though the consensus today is that the past cannot be changed, science fiction writers have used the idea of changing the past for good story effect". Time travel to the past and precognition without the ability to change events may result in causal loops.
The possibility of characters inadvertently or intentionally changing the past also gave rise to the idea of "time police", people tasked with preventing such changes from occurring by themselves engaging in time travel to rectify such changes.