Fantasy is a genre of speculative fiction involving magical elements, typically set in a fictional universe and usually inspired by mythology or folklore. The term "fantasy" can also be used to describe a "work of this genre", usually literary.
Its roots are in oral traditions, which became fantasy literature and drama. From the twentieth century, it has expanded further into various media, including film, television, graphic novels, manga, animations and video games.
Alternate terms for the genre include phantasy, although this is rarely used, xuanhuan (for Chinese fantasy works with a strong emphasis on magic), and qihuan (for Chinese fantasy novels that take place in fantasy worlds that combine elements from European and Chinese fantasy).
Fantasy is distinguished from the genres of science fiction and horror by the absence of scientific or macabre themes, although these can occur in fantasy. In popular culture, the fantasy genre predominantly features settings that emulate Earth, but with a sense of otherness. In its broadest sense, however, fantasy consists of works by many writers, artists, filmmakers, and musicians from ancient myths and legends to many recent and popular works.
Most fantasy uses magic or other supernatural elements as a main plot element, theme, or setting. Magic, magic practitioners (sorcerers, witches and so on) and magical creatures are common in many of these worlds.
An identifying trait of fantasy is the author's use of narrative elements that do not have to rely on history or nature to be coherent. This differs from realistic fiction in that realistic fiction has to attend to the history and natural laws of reality, where fantasy does not. In writing fantasy the author uses worldbuilding to create characters, situations, and settings that may not be possible in reality.
Many fantasy authors use real-world folklore and mythology as inspiration; and although another defining characteristic of the fantasy genre is the inclusion of supernatural elements, such as magic, this does not have to be the case.