Fantasy comedy or comic fantasy is a subgenre of fantasy that is primarily humorous in intent and tone. Typically set in imaginary worlds, fantasy comedy often includes puns on and parodies of other works of fantasy.
The subgenre rose in the nineteenth century. Elements of fantasy comedy can be found in such nineteenth century works as some of Hans Christian Andersen's fairy tales, Charles Dickens' "Christmas Books", and Lewis Carroll's Alice books. The first writer to specialize in the subgenre was "F. Anstey" in novels such as Vice Versa (1882), where magic disrupts Victorian society with humorous results. Anstey's work was popular enough to inspire several imitations, including E. Nesbit's light-hearted children's fantasies, The Phoenix and the Carpet (1904) and The Story of the Amulet (1906). The United States had several writers of fantasy comedy, including James Branch Cabell, whose satirical fantasy Jurgen, A Comedy of Justice (1919) was the subject of an unsuccessful prosecution for obscenity. Another American writer in a similar vein was Thorne Smith, whose works (such as Topper and The Night Life of the Gods) were popular and influential, and often adapted for film and television. Humorous fantasies narrated in a "gentleman's club" setting are common; they include John Kendrick Bangs' A Houseboat on the Styx (1895), Lord Dunsany's "Jorkens" stories, and Maurice Richardson's The Exploits of Englebrecht (1950).
According to Lin Carter, T. H. White's works exemplify fantasy comedy, L. Sprague de Camp and Fletcher Pratt's Harold Shea stories are early exemplars. The overwhelming bulk of de Camp's fantasy was comic. Pratt and de Camp were among several contributors to Unknown Worlds, a pulp magazine which emphasized fantasy with a comedic element. The work of Fritz Leiber also appeared in Unknown Worlds, including his Fafhrd and the Gray Mouser stories, a jocose take on the sword and sorcery subgenre.
In more modern times, Terry Pratchett's Discworld books, Piers Anthony's Xanth books, Robert Asprin's MythAdventures of Skeeve and Aahz books, and Tom Holt's books provide good examples, as do many of the works by Christopher Moore. There are also comic-strips/graphic novels in the humorous fantasy genre, including Chuck Whelon's Pewfell series and the webcomics 8-Bit Theater and The Order of the Stick. Other recent authors in the genre include Toby Frost, Stuart Sharp, Nicholas Andrews, and DC Farmer, and the writing team of John P. Logsdon and Christopher P. Young.
The subgenre has also been represented in television, such as in the television series I Dream of Jeannie, Kröd Mändoon. Examples on radio are the BBC's Hordes of the Things and ElvenQuest. Fantasy comedy films can either be parodies (Monty Python and the Holy Grail), comedies with fantastical elements (Being John Malkovich) or animated (Shrek). It has also been used in the movie Jumanji: Welcome to the Jungle.