Stories involving magic and terrible monsters have existed in spoken forms before the advent of printed literature. Classical mythology is replete with fantastical stories and characters, the best known (and perhaps the most relevant to modern fantasy) being the works of Homer (Greek) and Virgil (Roman). The contribution of the Greco-Roman world to fantasy is vast and includes: The hero's journey (also the figure of the chosen hero); magic gifts donated to win (including the ring of power as in the Gyges story contained in the Republic of Plato), prophecies (the oracle of Delphi), monsters and creatures (especially dragons), magicians and witches with the use of magic.
The philosophy of Plato has had great influence on the fantasy genre. In the Christian Platonic tradition, the reality of other worlds, and an overarching structure of great metaphysical and moral importance, has lent substance to the fantasy worlds of modern works. The world of magic is largely connected with the later Roman Greek world.
With Empedocles,(c. 490 – c. 430 BC) the elements, they are often used in fantasy works as personifications of the forces of nature. Other than magic concerns include: the use of a mysterious tool endowed with special powers (the wand); the use of a rare magical herb; a divine figure that reveals the secret of the magical act.
India has a long tradition of fantastical stories and characters, dating back to Vedic mythology. The Panchatantra (Fables of Bidpai), which some scholars believe was composed around the 3rd century BC. It is based on older oral traditions, including "animal fables that are as old as we are able to imagine".
was influential in Europe and the Middle East. It used various animal fables and magical tales to illustrate the central Indian principles of political science. Talking animals endowed with human qualities have now become a staple of modern fantasy.
The Baital Pachisi (Vikram and the Vampire), a collection of various fantasy tales set within a frame story is, according to Richard Francis Burton and Isabel Burton, the germ which culminated in the Arabian Nights, and which also inspired the Golden Ass of Apuleius, (2nd century A.D). Boccacio's Decamerone (c.1353) the Pentamerone (1634,1636) and all that class of facetious fictitious literature."
The Book of One Thousand and One Nights (Arabian Nights) from the Middle East has been influential in the West since it was translated from the Arabic into French in 1704 by Antoine Galland. Many imitations were written, especially in France. Various characters from this epic have themselves become cultural icons in Western culture, such as Aladdin, Sinbad and Ali Baba.
The Fornaldarsagas, Norse and Icelandic sagas, both of which are based on ancient oral tradition influenced the German Romantics, as well as William Morris, and J. R. R. Tolkien. The Anglo-Saxon epic poem Beowulf has also had deep influence on the fantasy genre; although it was unknown for centuries and so not developed in medieval legend and romance, several fantasy works have retold the tale, such as
John Gardner's Grendel.
Celtic folklore and legend has been an inspiration for many fantasy works.
The Welsh tradition has been particularly influential, owing to its connection to King Arthur and its collection in a single work, the epic Mabinogion. One influential retelling of this was the fantasy work of Evangeline Walton. The Irish Ulster Cycle and Fenian Cycle have also been plentifully mined for fantasy. Its greatest influence was, however, indirect. Celtic folklore and mythology provided a major source for the Arthurian cycle of chivalric romance: the Matter of Britain. Although the subject matter was heavily reworked by the authors, these romances developed marvels until they became independent of the original folklore and fictional, an important stage in the development of fantasy.
From the 13th century
Romance or chivalric romance is a type of prose and verse narrative that was popular in the aristocratic circles of High Medieval and Early Modern Europe. They were fantastic stories about marvel-filled adventures, often of a knight-errant portrayed as having heroic qualities, who goes on a quest, yet it is "the emphasis on love and courtly manners distinguishes it from the chanson de geste and other kinds of epic, in which masculine military heroism predominates." Popular literature also drew on themes of romance, but with ironic, satiric or burlesque intent. Romances reworked legends, fairy tales, and history to suit the readers' and hearers' tastes, but by c. 1600 they were out of fashion, and Miguel de Cervantes famously burlesqued them in his novel Don Quixote. Still, the modern image of "medieval" is more influenced by the romance than by any other medieval genre, and the word medieval evokes knights, distressed damsels, dragons, and other romantic tropes.
Originally, romance literature was written in Old French, Anglo-Norman, Occitan, and Provençal, and later in Portuguese, in Castilian, in English, in Italian (particularly with the Sicilian poetry) and German. During the early 13th century, romances were increasingly written as prose. In later romances, particularly those of French origin, there is a marked tendency to emphasize themes of courtly love, such as faithfulness in adversity.
At the time of the Renaissance romance continued to be popular. The trend was to more fantastic fiction. The English Le Morte d'Arthur by Sir Thomas Malory (c.1408–1471), was written in prose; this work dominates the Arthurian literature. Arthurian motifs have appeared steadily in literature from its publication, though the works have been a mix of fantasy and non-fantasy works. At the time, it and the Spanish Amadis de Gaula (1508), (also prose) spawned many imitators, and the genre was popularly well-received, producing such masterpiece of Renaissance poetry as Ludovico Ariosto's Orlando furioso and Torquato Tasso's Gerusalemme Liberata. Ariosto's tale, many marvels, and adventures, was a source text for many fantasies of adventure.
During the Renaissance Giovanni Francesco Straparola wrote and published The Facetious Nights of Straparola(1550-1555), a collection of stories, many of which are literary fairy tales Giambattista Basile wrote and published the Pentamerone a collection of literary fairy tales, the first collection of stories to contain solely the stories later to be known as fairy tales. Both of these works includes the oldest recorded form of many well-known (and more obscure) European fairy tales. This was the beginning of a tradition that would both influence the fantasy genre and be incorporated in it, as many works of fairytale fantasy appear to this day.
William Shakespeare's A Midsummer Night's Dream (1594/5), the Weird Sisters in Macbeth and Prospero in The Tempest (or Doctor Faustus in Christopher Marlowe's play) would be deeply influential on later works of fantasy.
In a work on alchemy in the 16th century, Paracelsus (1493 – 1541) identified four types of beings with the four elements of alchemy: gnomes, earth elementals; undines, water elementals; sylphs, air elementals; and salamanders, fire elementals. Most of these beings are found in folklore as well as alchemy; their names are often used interchangeably with similar beings from folklore.
Literary fairy tales, such as were written by Charles Perrault (1628 – 1703), and Madame d'Aulnoy ((c.1650 - 1705)), became very popular, early in the Age of Enlightenment. Many of Perrault's tales became fairy tale staples, and influenced latter fantasy as such. Indeed, when Madame d'Aulnoy termed her works contes de fée (fairy tales), she invented the term that is now generally used for the genre, thus distinguishing such tales from those involving no marvels. This influenced later writers, who took up the folk fairy tales in the same manner, in the Romantic era.
Several fantasies aimed at an adult readership were also published in 18th century France, including Voltaire's
"contes philosophique" "The Princess of Babylon" (1768) and "The White Bull" (1774).
This era, however, was notably hostile to fantasy. Writers of the new types of fiction such as Defoe, Richardson, and Fielding were realistic in style, and many early realistic works were critical of fantastical elements in fiction.
Romanticism, a movement of the late eighteenth and early nineteenth century, was a dramatic reaction to rationalism, challenging the priority of reason and promoting the importance of imagination and spirituality. Its success in rehabilitating imagination was of fundamental importance to the evolution of fantasy, and its interest in medieval romances providing many motifs to modern fantasy.
The Romantics invoked the medieval romance as justification for the works they wanted to produce, in distinction from the realistic pressure of the Enlightenment; these were not always fantastic, sometimes being merely unlikely to happen, but the justification was used even from fantasy. One of the first literary results of this fascinations was Gothic novel, a literary genre that began in Britain with The Castle of Otranto (1764) by Horace Walpole, which is the predecessor to both modern fantasy and modern horror fiction . One noted Gothic novel which also
contains a large amount of fantasy elements (derived from the "Arabian Nights") is Vathek (1786) by William Thomas Beckford.
In the later part of the Romantic tradition, in reaction to the spirit of the Enlightenment, folklorists collected folktales, epic poems, and ballads, and brought them out in printed form. The Brothers Grimm were inspired in their collection, Grimm's Fairy Tales, (1812) by the movement of German Romanticism. Many other collectors were inspired by the Grimms and the similar sentiments. Frequently their motives stemmed not merely from Romanticism, but from Romantic nationalism, in that many were inspired to save their own country's folklore: sometimes, as in the Kalevala, they compiled existing folklore into an epic to match other nation's; sometimes, as in Ossian, (1760) they fabricated folklore that should have been there. These works, whether fairy tale, ballads, or folk epics, were a major source for later fantasy works.
The Romantic interest in medievalism also resulted in a revival of interest in the literary fairy tale. The tradition begun with Giovanni Francesco Straparola ((ca. 1485?-1558) )and Giambattista Basile (1566 – 1632) and developed by the Charles Perrault(1628 – 1703) and the French précieuses, was taken up by the German Romantic movement.
Friedrich de la Motte Fouqué created medieval-set stories such as Undine (1811) and Sintram and his Companions (1815)
which would later inspire British writers such as MacDonald and Morris.
E. T. A. Hoffmann's tales, such as "The Golden Pot" (1814) and "The Nutcracker and the Mouse King" (1816) were notable additions to the canon of German fantasy.
 Ludwig Tieck's collection Phantasus (1812-1817)
contained several short fairy tales, including "The Elves".
In France, the main writers of Romantic-era fantasy were Charles Nodier, with Smarra (1821) and
Trilby (1822)  and Théophile Gautier in
stories such as "Omphale" (1834) and "One of Cleopatra's Nights" (1838),
and the later novel Spirite (1866).
Fantasy literature was popular in Victorian times, with the works of writers such as Mary Shelley (1797 – 1851), William Morris and George MacDonald, and Charles Dodgson, author of Alice in Wonderland (1865).
Hans Christian Andersen (1805 – 1875) initiated a new style of fairy tales, original tales told in seriousness. From this origin, John Ruskin wrote The King of the Golden River (1851), a fairy tale that uses new levels of characterization, creating in the South-West Wind an irascible but kindly character similar to the Tolkien's later Gandalf.
The history of modern fantasy literature begins with George MacDonald (1824 – 1905), author of such novels as The Princess and the Goblin (1868) and Phantastes (1868) the latter of which is widely considered to be the first fantasy novel ever written for adults. MacDonald also wrote one of the first critical essays about the fantasy genre, "The Fantastic Imagination", in his book A Dish of Orts (1893). MacDonald was a major influence on both J. R. R. Tolkien and C. S. Lewis.
The other major fantasy author of this era was William Morris (1834 – 1896), a socialist, an admirer of Middle Ages, a reviver of British handcrafts and a poet, who wrote several fantastic romances and novels in the latter part of the century, of which the most famous was The Well at the World's End (1896). He was deeply inspired by the medieval romances and sagas; his style was deliberately archaic, based on medieval romances. In many respects, Morris was an important milestone in the history of fantasy, because, while other writers wrote of foreign lands, or of dream worlds, Morris's works were the first to be set in an entirely invented world: a fantasy world.
Authors such as Edgar Allan Poe (1809 – 1849) and Oscar Wilde (in The Picture of Dorian Gray, 1890) also developed fantasy, in the telling of horror tales, a separate branch of fantasy that was to have great influence on H. P. Lovecraft and other writers of dark fantasy. Wilde also wrote a large number of children's fantasies, collected in The Happy Prince and Other Stories (1888) and A House of Pomegranates (1891).
H. Rider Haggard developed the conventions of the Lost World subgenre with King Solomon's Mines (1885), which sometime included fantasy works as in Haggard's own She. With Africa still largely unknown to European writers, it offered scope to this type. Other writers, including Edgar Rice Burroughs and Abraham Merritt, built on the convention.
Several classic children's fantasies such as Lewis Carroll's Alice in Wonderland (1865), J. M. Barrie's Peter Pan (1906), L. Frank Baum's The Wonderful Wizard of Oz (1900), as well as the work of E. Nesbit (1858 – 1924)) and Frank R. Stockton (1834 – 1902)) were also published around this time. Indeed, C. S. Lewis noted that in the earlier part of the 20th century, fantasy was more accepted in juvenile literature, and therefore a writer interested in fantasy often wrote in it to find an audience, despite concepts that could form an adult work.
At this time, the terminology for the genre was not settled. Many fantasies in this era were termed fairy tales, including Max Beerbohm's "The Happy Hypocrite" (1896) and MacDonald's Phantastes. It was not until 1923 that the term "fantasist" was used to describe a writer (in this case, Oscar Wilde) who wrote fantasy fiction. The name "fantasy" was not developed until later; as late as J.R.R. Tolkien's The Hobbit (1937), the term "fairy tale" was still being used.
An important factor in the development of the fantasy genre was the arrival of magazines devoted to fantasy fiction. The first
such publication was the German magazine Der Orchideengarten which ran from 1919-1921.
In 1923, the first English-language fantasy fiction magazine, Weird Tales, was
created. Many other similar magazines eventually followed. and
The Magazine of Fantasy & Science Fiction  The pulp magazine format was at the height of its popularity at this time and was instrumental in bringing fantasy fiction to a wide audience in both the U.S. and Britain. Such magazines also played a large role in the rise of science fiction and it was at this time the two genres began to be associated with each other. Several of the genre's most prominent authors began their careers in these magazines, including Clark Ashton Smith, Fritz Leiber, Ray Bradbury and H. P. Lovecraft.
H. P. Lovecraft was deeply influenced by Edgar Allan Poe and to a somewhat lesser extent, by Lord Dunsany; with his Cthulhu Mythos stories, he became one of the most influential writers of fantasy and horror in the 20th century.
Despite MacDonald's future influence, and Morris' popularity at the time, it was not until around the start of the 20th century that fantasy fiction began to reach a large audience, with authors such as Lord Dunsany (1878 – 1957) who, following Morris's example, wrote fantasy novels, but also in the short story form. He was particularly noted for his vivid and evocative style. His style greatly influenced many writers, not always happily; Ursula K. Le Guin, in her essay on style in fantasy "From Elfland to Poughkeepsie", wryly referred to Lord Dunsany as the "First Terrible Fate that Awaiteth Unwary Beginners in Fantasy", alluding to young writers attempting to write in Lord Dunsany's style. According to S. T. Joshi, "Dunsany's work had the effect of segregating fantasy—a mode whereby the author creates his own realm of pure imagination—from supernatural horror. From the foundations he established came the later work of E. R. Eddison, Mervyn Peake, and J. R. R. Tolkien.
In Britain in the aftermath of World War I, a notably large number of fantasy books aimed at an adult readership were published,
including Living Alone (1919) by Stella Benson,
A Voyage to Arcturus (1920) by David Lindsay, Lady into Fox (1922) by
David Garnett, Lud-in-the-Mist (1926) by Hope Mirrlees, and Lolly Willowes (1926) by
Sylvia Townsend Warner. E. R. Eddison was another influential writer, wrote during this era. He drew inspiration from Northern sagas, as Morris did, but his prose style was modeled more on Tudor and Elizabethan English, and his stories were filled with vigorous characters in glorious adventures. Eddison's most famous work is The Worm Ouroboros (1922), a long heroic fantasy set on an imaginary version of the planet Mercury.
Literary critics of the era began to take an interest in "fantasy" as a genre of writing, and also to argue that it was a genre worthy of serious consideration. Herbert Read devoted a chapter of his book English Prose Style (1928) to discussing "Fantasy" as an aspect of literature, arguing it was unjustly considered suitable only for children: "The Western World does not seem to have conceived the necessity of Fairy Tales for Grown-Ups".
In 1938, with the publication of The Sword in the Stone, T. H. White introduced one of the most notable works of comic fantasy.
J. R. R. Tolkien played a large role in the popularization and accessibility of the fantasy genre with his highly successful publications The Hobbit (1937) and The Lord of the Rings (1954–55). Tolkien was largely influenced by an ancient body of Anglo-Saxon myths, particularly Beowulf, as well as E. R. Eddison's 1922 novel, The Worm Ouroboros. Tolkien's close friend C. S. Lewis, author of The Chronicles of Narnia (1950–56) and a fellow English professor with a similar array of interests, also helped to publicize the fantasy genre.
The tradition established by these predecessors of the late nineteenth and early twentieth centuries has continued to thrive and be adapted by new authors. The influence of J.R.R. Tolkien's fiction has—particularly over the genre of high fantasy—prompted a reaction. Works of metafictional fantasy were published in the late twentieth century, that self-consciously allude to the history and literary conventions of the genre, including Terry Pratchett's Discworld series (1983-2015), and Neil Gaiman's Stardust (1999).
At the turn of the millennium, the Harry Potter novels of J. K. Rowling, which chronicle the life of a young wizard, achieved widespread popularity.
It is not uncommon for fantasy novels to be ranked on The New York Times Best Seller list, and some have been at number one on the list, including most recently, Brandon Sanderson in 2014, George R. R. Martin in 2011, Neil Gaiman in 2013, Terry Goodkind in 2006  and Patrick Rothfuss in 2011.