To submit requests for assistance, or provide feedback regarding accessibility, please contact


Understanding Deus Ex Machina: Definition and Examples in Literature

Written by MasterClass

Last updated: Feb 11, 2020 • 3 min read

The deus ex machina device is generally regarded as a cheap way to insert an easy conclusion, but it can also function as a comedic device or add an element of surprise. The use of deus ex machina has persisted throughout literature, and elements of it are seen in plenty of pieces of creative writing today.



David Mamet Teaches Dramatic WritingDavid Mamet Teaches Dramatic Writing

The Pulitzer Prize winner teaches you everything he's learned across 26 video lessons on dramatic writing.

Learn More

What Is Deus Ex Machina?

In literary terms, deus ex machina is a plot device used when a seemingly unsolvable conflict or impossible problem is solved by the sudden appearance of an unexpected person, object, or event. Deus ex machina does not have to refer to a literal machine—it can be the emergence of a new character, a surprising use of magic, or even the realization that “it was all just a dream.”

Origin of the Term Deus Ex Machina

Deus ex machina is a Latin term literally translated from a Greek phrase meaning “god from the machine.” The term originated in ancient Greek theater as a reference to the stage machinery that would bring statues of deities or actors playing gods to and from the stage. The machine could be a crane to lift the actor or statue, or a mechanism letting it rise through a trapdoor in the floor. This machine would allow the “gods” to appear and provide divine intervention at the end of a play in order to provide a neat solution or happy ending.

David Mamet Teaches Dramatic Writing
Judy Blume Teaches Writing
Malcolm Gladwell Teaches Writing
James Patterson Teaches Writing

How Is Deus Ex Machina Used?

Deus ex machina refers to when a previously unforeseen event, ability, or object outside the story suddenly appears to save the day. According to some critics, in order for it to be a true deus ex machina, the new element cannot have been foreshadowed or predicted in any way. Some view the use of the deus ex machina device as a way to introduce a simple solution into a hopeless situation—a lazy author wrote themselves into a corner and has taken the easy way out in order to produce a happy ending. However, deus ex machina can also provide a means of comic relief—a solution so bizarre and ridiculous it becomes funny.

What Is the Difference Between a Deus Ex Machina and a Plot Twist?

It is important to note that deus ex machina is often considered a contrived solution, and is not the same as a plot twist. A plot twist is a turn of events that offers opportunities for growth and development for your characters. When a plot twist appears near the midway point of a narrative, it grips your audience’s attention and inspires the careful study of all the details that will follow. When a plot twist appears at the end of the film or in the final pages of a novel, it tends to form the lasting memories that an audience associates with your narrative.

An interesting narrative needs real story twists that are fueled by plot progression and character motivations—and deus ex machina rarely, if ever, provides a satisfying enough payoff for readers who have become invested in your world and the trajectory of its inhabitants.


Suggested for You

Online classes taught by the world’s greatest minds. Extend your knowledge in these categories.

David Mamet

Teaches Dramatic Writing

Learn More
Judy Blume

Teaches Writing

Learn More
Malcolm Gladwell

Teaches Writing

Learn More
James Patterson

Teaches Writing

Learn More

5 Examples of Deus Ex Machina

Think Like a Pro

The Pulitzer Prize winner teaches you everything he's learned across 26 video lessons on dramatic writing.

View Class

There are many examples of deus ex machina as a literary device used in Greek plays, as well as some (albeit disputed) contemporary examples:

  1. William Shakespeare’s As You Like It (1603): Hymen, the god of marriage, appears during the final act to “fix” the romantic entanglements of the main characters.
  2. Euripides’s Medea (431 BCE): Euripides’s use of deus ex machina in this Greek drama shows flawed protagonist Medea commit atrocious crimes throughout the narrative, only to completely escape punishment when she is saved by a chariot sent by her grandfather and god of the sun, Helios.
  3. Aeschylus’s Oresteia (458 BCE): The protagonist is saved at the last minute from an honor killing by the god Apollo, who has decided that only evidence and reason will be used to serve justice from now on—not killing.
  4. Batman: Batman’s utility belt often contains some unexpected but very convenient life-saving device he’s able to employ right in the nick of time. While many expect Batman to come equipped with tools like this, their sometimes convenient specificity qualifies as deus ex machina.
  5. H. G. Wells’s War of the Worlds (1898): Some critics consider the ending of Wells’ story—where the unstoppable alien onslaught ends due to a biological oversight—to be an example of deus ex machina.

Want to Learn More About Writing?

Become a better writer with the Masterclass All-Access Pass. Gain access to exclusive video lessons taught by literary masters, including Neil Gaiman, David Baldacci, Joyce Carol Oates, Dan Brown, Margaret Atwood, David Sedaris, and more.