As a literary device, an allegory is a narrative in which a character, place, or event is used to deliver a broader message about real-world issues and occurrences. Authors have used allegory throughout history in all forms of art to illustrate or convey complex ideas and concepts in ways that are comprehensible or striking to its viewers, readers, or listeners.
Writers and speakers typically use allegories to convey (semi-)hidden or complex meanings through symbolic figures, actions, imagery, or events, which together create the moral, spiritual, or political meaning the author wishes to convey. Many allegories use personification of abstract concepts.
First attested in English in 1382, the word allegory comes from Latin allegoria, the latinisation of the Greek (allegoría), "veiled language, figurative", which in turn comes from both (allos), "another, different" and ? (agoreuo), "to harangue, to speak in the assembly", which originates from (agora), "assembly".
Northrop Frye discussed what he termed a "continuum of allegory", a spectrum that ranges from what he termed the "naive allegory" of The Faerie Queene, to the more private allegories of modern paradox literature. In this perspective, the characters in a "naive" allegory are not fully three-dimensional, for each aspect of their individual personalities and the events that befall them embodies some moral quality or other abstraction; the allegory has been selected first, and the details merely flesh it out.
The origins of allegory can be traced at least back to Homer in his "quasi-allegorical" use of personifications of, e.g., Terror (Deimos) and Fear (Phobos) at Il. 115 f.  The title of "first allegorist," however, is usually awarded to whoever was the earliest to put forth allegorical interpretations of Homer. This approach leads to two possible answers: Theagenes of Rhegium (whom Porphyry calls the "first allegorist," Porph. Quaest. Hom. 1.240.14-241.12 Schrad.) or Pherecydes of Syros, both of whom are presumed to be active in the 6th century B.C.E., though Pherecydes is earlier and as he is often presumed to be the first writer of prose. The debate is complex, since it demands we observe the distinction between two often conflated uses of the Greek verb "all?gore?n," which can mean both "to speak allegorically" and "to interpret allegorically." 
In the case of "interpreting allegorically," Theagenes appears to be our earliest example. Presumably in response to proto-philosophical moral critiques of Homer (e.g. Xenophanes fr. 11 Diels-Kranz ), Theagenes proposed symbolic interpretations whereby the Gods of the Iliad actually stood for physical elements. So, Hephestus represents Fire, for instance (for which see fr. A2 in Diels-Kranz ). Some scholars, however, argue that Pherecydes cosmogonic writings anticipated Theagenes allegorical work, illustrated especially by his early placement of Time (Chronos) in his genealogy of the gods, which is thought to be a reinterpretation of the titan Kronos, from more traditional genealogies.
Among the best-known examples of allegory, Plato's Allegory of the Cave, forms a part of his larger work The Republic. In this allegory, Plato describes a group of people who have lived chained in a cave all of their lives, facing a blank wall (514a-b). The people watch shadows projected on the wall by things passing in front of a fire behind them and begin to ascribe forms to these shadows, using language to identify their world (514c-515a). According to the allegory, the shadows are as close as the prisoners get to viewing reality, until one of them finds his way into the outside world where he sees the actual objects that produced the shadows. He tries to tell the people in the cave of his discovery, but they do not believe him and vehemently resist his efforts to free them so they can see for themselves (516e-518a). This allegory is, on a basic level, about a philosopher who upon finding greater knowledge outside the cave of human understanding, seeks to share it as is his duty, and the foolishness of those who would ignore him because they think themselves educated enough.
In Late Antiquity Martianus Capella organized all the information a fifth-century upper-class male needed to know into an allegory of the wedding of Mercury and Philologia, with the seven liberal arts the young man needed to know as guests. Also the Neoplatonic philosophy developed a type of allegorical reading of Homer and Plato.
Other early allegories are found in the Hebrew Bible, such as the extended metaphor in Psalm 80 of the Vine and its impressive spread and growth, representing Israel's conquest and peopling of the Promised Land. Also allegorical is Ezekiel 16 and 17, wherein the capture of that same vine by the mighty Eagle represents Israel's exile to Babylon.
Allegorical interpretation of the Bible was a common early Christian practice and continues. For example, the recently re-discovered IVth Commentary on the Gospels by Fortunatianus of Aquileia has a comment by its English translator: "The principal characteristic of Fortunatianus' exegesis is a figurative approach, relying on a set of concepts associated with key terms in order to create an allegorical decoding of the text." (pXIX)
Allegory has an ability to freeze the temporality of a story, while infusing it with a spiritual context. Mediaeval thinking accepted allegory as having a reality underlying any rhetorical or fictional uses. The allegory was as true as the facts of surface appearances. Thus, the Papal Bull Unam Sanctam (1302) presents themes of the unity of Christendom with the pope as its head in which the allegorical details of the metaphors are adduced as facts on which is based a demonstration with the vocabulary of logic: "Therefore of this one and only Church there is one body and one head--not two heads as if it were a monster... If, then, the Greeks or others say that they were not committed to the care of Peter and his successors, they necessarily confess that they are not of the sheep of Christ." This text also demonstrates the frequent use of allegory in religious texts during the Mediaeval Period, following the tradition and example of the Bible.
In the late 15th century, the enigmatic Hypnerotomachia, with its elaborate woodcut illustrations, shows the influence of themed pageants and masques on contemporary allegorical representation, as humanist dialectic conveyed them.
The denial of medieval allegory as found in the 12th-century works of Hugh of St Victor and Edward Topsell's Historie of Foure-footed Beastes (London, 1607, 1653) and its replacement in the study of nature with methods of categorisation and mathematics by such figures as naturalist John Ray and the astronomer Galileo is thought to mark the beginnings of early modern science.
Since meaningful stories are nearly always applicable to larger issues, allegories may be read into many stories which the author may not have recognised. This is allegoresis, or the act of reading a story as an allegory. Examples of allegory in popular culture that may or may not have been intended include the works of Bertolt Brecht, and even some works of science fiction and fantasy, such as The Chronicles of Narnia by C. S. Lewis.
The story of the apple falling onto Isaac Newton's head is another famous allegory. It simplified the idea of gravity by depicting a simple way it was supposedly discovered. It also made the scientific revelation well known by condensing the theory into a short tale.
While allegoresis may make discovery of allegory in any work, not every resonant work of modern fiction is allegorical, and some are clearly not intended to be viewed this way. According to Henry Littlefield's 1964 article, L. Frank Baum's The Wonderful Wizard of Oz, may be readily understood as a plot-driven fantasy narrative in an extended fable with talking animals and broadly sketched characters, intended to discuss the politics of the time. Yet, George MacDonald emphasised in 1893 that "A fairy tale is not an allegory."
J. R. R. Tolkien's The Lord of the Rings is another example of a well-known work mistakenly perceived as allegorical, as the author himself once stated, "...I cordially dislike allegory in all its manifestations, and always have done so since I grew old and wary enough to detect its presence. I much prefer history - true or feigned- with its varied applicability to the thought and experience of readers. I think that many confuse applicability with allegory, but the one resides in the freedom of the reader, and the other in the purposed domination of the author."
Tolkien specifically resented the suggestion that the book's One Ring, which gives overwhelming power to those possessing it, was intended as an allegory of nuclear weapons. He noted that, had that been his intention, the book would not have ended with the Ring being destroyed but rather with an arms race in which various powers would try to obtain such a Ring for themselves. Then Tolkien went on to outline an alternative plot for "Lord of The Rings", as it would have been written had such an allegory been intended, and which would have made the book into a dystopia. While all this does not mean Tolkien's works may not be treated as having allegorical themes, especially when reinterpreted through postmodern sensibilities, it at least suggests that none were conscious in his writings. This further reinforces the idea of forced allegoresis, as allegory is often a matter of interpretation and only sometimes of original artistic intention.
Like allegorical stories, allegorical poetry has two meanings - a literal meaning and a symbolic meaning.
Some unique specimens of allegory can be found in the following works:
Some elaborate and successful specimens of allegory are to be found in the following works, arranged in approximate chronological order:
Jan van Kessel, Allegory of Hearing (17th century): Diverse sources of sound, especially instruments serve as allegorical symbols.