Fantasy is a genre that uses magic and other supernatural forms as a primary element of plot, theme, and/or setting. Fantasy is generally distinguished from science fiction and horror by the expectation that it steers clear of technological and macabre themes, respectively, though there is a great deal of overlap between the three.
The identifying traits of fantasy are the inclusion of fantastic elements in a self-coherent setting, where inspiration from mythology and folklore remains a consistent theme. Within such a structure, any location of the fantastical element is possible: it may be hidden in, or leak into the apparently real world setting, it may draw the characters into a world with such elements, or it may occur entirely in a fantasy world setting, where such elements are part of the world. Essentially, fantasy follows rules of its own making, allowing magic and other fantastic devices to be used and still be internally cohesive.