A story within a story, also referred to as an embedded narrative, is a narrative device in which a character within a story becomes the narrator of a second story. Multiple layers of stories within stories are sometimes called nested stories. A play may include a brief play within it, as in Shakespeare's Hamlet (a "play within a play"); a film may show the characters watching a short film; or a novel may contain a short story within it. A story within a story can thus occur in any narrative forms, including poems and songs. If the majority of a whole story's content is introduced or presented using the device of a story within a story (a less-detailed "outer" story that contains the main detailed story), this is also called a frame narrative.

Stories within stories can be used simply to enhance entertainment for the reader or viewer, or can act as examples to teach lessons to other characters. The inner story often has a symbolic and psychological significance for the characters in the outer story. There is often some parallel between the two stories, and the fiction of the inner story is used to reveal the truth in the outer story. Often the stories within a story are used to satirize views, not only in the outer story, but also in the real world. When a story is told within another instead of being told as part of the plot, it allows the author to play on the reader's perceptions of the characters—the motives and the reliability of the storyteller are automatically in question.

Stories within a story may disclose the background of characters or events, tell of myths and legends that influence the plot, or even seem to be extraneous diversions from the plot. In some cases, the story within a story is involved in the action of the plot of the outer story. In others, the inner story is independent and could either be skipped or stand separately, although many subtle connections may be lost. Often there is more than one level of internal stories, leading to deeply-nested fiction. Mise en abyme is the French term for a similar literary device (also referring to the practice in heraldry of placing the image of a small shield on a larger shield).

Frame stories and anthology works

The literary device of stories within a story dates back to a device known as a "frame story", where a supplemental story is used to help tell the main story. Typically, the outer story or "frame" does not have much matter, and most of the work consists of one or more complete stories told by one or more storytellers.

The earliest examples of "frame stories" and "stories within stories" were in ancient Egyptian and Indian literature, such as the Egyptian "Tale of the Shipwrecked Sailor" and Indian epics like the Ramayana, Seven Wise Masters, Hitopadesha and Vikrama and Vethala. In Vishnu Sarma's Panchatantra, an interwoven series of colorful animal tales are told with one narrative opening within another, sometimes three or four layers deep, and then unexpectedly snapping shut in irregular rhythms to sustain attention. In the epic Mahabharata, the Kurukshetra War is narrated by a character in Vyasa's Jaya, which itself is narrated by a character in Vaisampayana's Bharata, which itself is narrated by a character in Ugrasrava's Mahabharata.

Both The Golden Ass by Apuleius and Metamorphoses by Ovid extend the depths of framing to several degrees. Another early example is the One Thousand and One Nights (Arabian Nights), where the general story is narrated by an unknown narrator, and in this narration the stories are told by Scheherazade. In many of Scheherazade's narrations, there are also stories narrated, and even in some of these, there are other stories. An example of this is "The Three Apples", a murder mystery narrated by Scheherazade. Within the story, after the murderer reveals himself, he narrates a flashback of events leading up to the murder. Within this flashback, an unreliable narrator tells a story to mislead the would-be murderer, who later discovers that he was misled after another character narrates the truth to him. As the story concludes, the "Tale of Núr al-Dín Alí and his Son" is narrated within it. This perennially popular work can be traced back to Arabic, Persian, and Indian storytelling traditions.

Mary Shelley's Frankenstein has a deeply nested frame story structure, that features the narration of Walton, who records the narration of Victor Frankenstein, who recounts the narration of his creation, who narrates the story of a cabin dwelling family he secretly observes. Another classic novel with a frame story is Wuthering Heights, the majority of which is recounted by the central family's housekeeper to a boarder. Similarly, Roald Dahl's story The Wonderful Story of Henry Sugar is about a rich bachelor who finds an essay written by someone who learned to "see" playing cards from the reverse side. The full text of this essay is included in the story, and itself includes a lengthy sub-story told as a true experience by one of the essay's protagonists, Imhrat Khan.

Lewis Carroll's Alice books, Alice's Adventures in Wonderland (1865) and Through the Looking-Glass (1871), have several multiple poems that are mostly recited by several characters to the titular character. The most notable examples are "You Are Old, Father William", 'Tis the Voice of the Lobster", "Jabberwocky", and "The Walrus and the Carpenter".

Chaucer's The Canterbury Tales and Boccaccio's Decameron are also classic frame stories. In The Canterbury Tales, the characters tell tales suited to their personalities and tell them in ways that highlight their personalities. The noble knight tells a noble story, the boring character tells a very dull tale, and the rude miller tells a smutty tale. Homer's Odyssey too makes use of this device; Odysseus' adventures at sea are all narrated by Odysseus to the court of king Alcinous in Scheria. Other shorter tales, many of them false, account for much of the Odyssey. Many modern children's story collections are essentially anthology works connected by this device, such as Arnold Lobel's Mouse Tales, Paula Fox's The Little Swineherd, and Phillip and Hillary Sherlock's Ears and Tails and Common Sense.

A well-known modern example of framing is the fantasy genre work The Princess Bride (both the book and the film). In the film, a grandfather is reading the story of The Princess Bride to his grandson. In the book, a more detailed frame story has a father editing a much longer (but fictive) work for his son, creating his own "Good Parts Version" (as the book called it) by leaving out all the parts that would bore or displease a young boy. Both the book and the film assert that the central story is from a book called The Princess Bride by a nonexistent author named S. Morgenstern.

In the Welsh novel (1852) by Gwilym Hiraethog, a visitor to a farm in north Wales tells the story of Uncle Tom's Cabin to those gathered around the hearth.

Sometimes a frame story exists in the same setting as the main story. On the television series The Young Indiana Jones Chronicles, each episode was framed as though it were being told by Indy when he was older (usually acted by George Hall, but once by Harrison Ford). The same device of an adult narrator representing the older version of a young protagonist is used in the films Stand by Me and A Christmas Story, and the television show The Wonder Years and How I Met Your Mother.

Frame stories in music In The Amory Wars, a tale told through the music of Coheed and Cambria, tells a story for the first two albums but reveals that the story is being actively written by a character called the Writer in the third. During the album, the Writer delves into his own story and kills one of the characters, much to the dismay of the main character.

The critically acclaimed Beatles album Sgt. Pepper's Lonely Hearts Club Band is presented as a stage show by the fictional eponymous band, and one of its songs, "A Day in the Life", is in the form of a story within a dream. Similarly, the Fugees album The Score is presented as the soundtrack to a fictional film, as are several other notable concept albums, while Wyclef Jean's The Carnival is presented as testimony at a trial. The majority of Ayreon's albums outline a sprawling, loosely interconnected science fiction narrative, as do the albums of Janelle Monae.

On Tom Waits's concept album Alice (consisting of music he wrote for the musical of the same name), most of the songs are (very) loosely inspired by both Alice in Wonderland, and the book's real-life author, Lewis Carroll, and inspiration Alice Liddell. The song "Poor Edward", however, is presented as a story told by a narrator about Edward Mordrake, and the song "Fish and Bird" is presented as a retold story that the narrator heard from a sailor.

Examples of nested stories by type

Nested books In his 1895 historical novel Pharaoh, Bolesław Prus introduces a number of stories within the story, ranging in length from vignettes to full-blown stories, many of them drawn from ancient Egyptian texts, that further the plot, illuminate characters, and even inspire the fashioning of individual characters. Jan Potocki's The Manuscript Found in Saragossa (1797–1805) has an interlocking structure with stories-within-stories reaching several levels of depth.

The provenance of the story is sometimes explained internally, as in The Lord of the Rings by J. R. R. Tolkien, which depicts the Red Book of Westmarch (a story-internal version of the book itself) as a history compiled by several of the characters. The subtitle of The Hobbit ("There and Back Again") is depicted as part of a rejected title of this book within a book, and The Lord of the Rings is a part of the final title.

An example of an interconnected inner story is "The Mad Trist" in Edgar Allan Poe's Fall of the House of Usher, where through somewhat mystical means the narrator's reading of the story within a story influences the reality of the story he has been telling, so that what happens in "The Mad Trist" begins happening in "The Fall of the House of Usher". Also, in Don Quixote by Miguel de Cervantes, there are many stories within the story that influence the hero's actions (there are others that even the author himself admits are purely digressive). Most of the first part is presented as a translation of a found manuscript by (fictional) Cide Hamete Benengeli.

A commonly independently anthologised story is "The Grand Inquisitor" by Dostoevsky from his long psychological novel The Brothers Karamazov, which is told by one brother to another to explain, in part, his view on religion and morality. It also, in a succinct way, dramatizes many of Dostoevsky's interior conflicts.

An example of a "bonus material" style inner story is the chapter "The Town Ho's Story" in Herman Melville's novel Moby-Dick; that chapter tells a fully formed story of an exciting mutiny and contains many plot ideas that Melville had conceived during the early stages of writing Moby-Dick—ideas originally intended to be used later in the novel—but as the writing progressed, these plot ideas eventually proved impossible to fit around the characters that Melville went on to create and develop. Instead of discarding the ideas altogether, Melville wove them into a coherent short story and had the character Ishmael demonstrate his eloquence and intelligence by telling the story to his impressed friends.

One of the most complicated structures of a story within a story was used by Vladimir Nabokov in his novel The Gift. There, as inner stories, function both poems and short stories by the main character Fyodor Cherdyntsev as well as the whole Chapter IV, a critical biography of Nikolay Chernyshevsky (also written by Fyodor). This novel is considered one of the first metanovels in literature.