Deus Ex Machina: How to USE and/or AVOID in Screenwriting

What is a Deus ex machina? It sounds like something technological and complex. But it’s actually quite simple.

Well, have you ever just been watching a film totally invested, your anticipation at an all-time high waiting for the ending? The movie has been good, and you cannot imagine anything taking away from it.

So, as the end approaches it becomes clear all hope is gone. Nothing will be able to save the characters in the film from certain death or their world from complete turmoil. The walls are closing in but suddenly out of nowhere by some miracle or ridiculously improbable stroke of luck the characters are saved.

After seeing this you walk out of the theater completely gobsmacked and you wonder what you just watched. You ask yourself ‘why did the writers even bother if the ending was going to be completely incompatible with the rest of the story?’

Many movies, unfortunately, end like this, employing the plot device known as a ‘Deus ex machina’. But can a Deus ex machina ever be useful and/or convincing in a screenplay? And how do you avoid using one? We take a look…

What is a Deus Ex Machina?


The term Deus ex machina originated from the practice in ancient Greek plays. At the end of the play an actor playing a god would be lowered onto the stage by a crane or type of machine. Then that god would save the day in the story.

Deus ex machina: “god from the machine”

One of the most popular examples of a Deus ex machina in Greek plays is in Medea by Euripides. In the play, after Medea has killed her and her husband Jason’s children, she is whisked away by the Sun god.

Having a god descend from the heavens and save the day soon became a popular practice in Greek playwriting. It became popular because bringing in a god to save the day helped bolster the moral message being delivered by the play.

In Modern Cinema

In modern screenwriting, a Deus ex machina is employed when you have created situations for your characters that are nearly impossible to get out of. This happens because of how the script is set up. Sometimes this is by accident and other times it is purposeful. Nonetheless, getting your characters out of trouble seems unlikely.

So, a Deus ex machina in modern writing is used to fix these situations. Unfortunately, it is almost always abrupt and something that takes away from the script more than it adds to it.

Additionally, a Deus ex machina can also be used to surprise the audience as a form of a plot twist. Whilst it can also act as a comedic device.

Furthermore, the “god” does not have to be a physical being. It can be an object, an unexpected ability, or a random event. It is something that has no previous setup but is thrown in to avoid a negative ending and provide a resolution.

Why Do Screenwriters Use a Deus Ex Machina?

Many stories may use a Deus ex machina because they can create an amazing story and just use a Deus ex machina to finish it off easily. And oftentimes the story may be so good that the presence of a Deus ex machina goes largely unremarked upon.

A good example of this is in The Lord of The Rings. This film series is generally praised as being some of the best fantasy work out there. So, because of this, the writer’s use of a Deus ex machina is somewhat palatable.

So why does this use of a Deus ex machina (arguably) not jar so much as it could?

  • Well, it partly comes from the fact that the world is so convincingly built prior to this moment that we are willing to go with where it takes us.
  • The idea of a giant eagle swooping down perhaps doesn’t strike as so out of the blue due to the depth of the fantasy world the story is set within. If the story was set in contemporary New York, the twist wouldn’t feel quite so smooth.
  • In addition, the story is full of moments that could arguably be described as Deus ex machinas. So one last twist doesn’t feel particularly surprising.

In this instance, the use of a Deus ex machina works within the context of the story. And it succeeds in providing hope for the characters when it seems there is none left. So, it’s not just about wrapping up the story, it’s about providing the characters (and us) with hope.

The Lord of the Rings: The Return of the King (7/9) Movie CLIP - Don't You Let Go (2003) HD


Deus ex machinas are mostly frowned upon and most people agree that they should be avoided. Some of those reasons include:

  • Deus ex machinas can almost completely invalidate an entire story because they are just a throwaway device.
  • When a Deus ex machina is used it calls the rest of the story into question.
  • And when this happens the important things that once drove the plot forward mean little in the end.
  • For the writer it raises the question ‘if the day was going to be saved by something completely out of left field, what was the point of the story in the first place?’ Why bother writing something that will just leave people going “why did I even bother watching that?”.

You want people to enjoy your stories and not have them thinking that you wasted their time.

  • As a writer, you do not want to develop a reputation of using a Deus ex machina in your scripts.
  • Using a Deus ex machina at all or too frequently can make you look like an incompetent writer.
  • It seems as if you are constantly writing stories that you do not have the ability to end.
  • Having this reputation can make it harder for people to take your work seriously.

M. Night Shyamalan, for example, has garnered this negative reputation with his plot twist endings.

  • For example, in his film Signs, the aliens are defeated by water.
  • Unfortunately, it is never established early on that the aliens have any weaknesses.
  • This makes the twist come as cheap. It seems like a twist for twist’s sake.

However, in The Sixth Sense, the plot twist ending doesn’t feel quite so jarring. This provides an interesting contrast, showing how foreshadowing can help alleviate the sense of a Deus ex machina.

Signs Water Deus Ex Machina

Suspension of Disbelief

Many critics paint using a Deus ex machina as lazy writing. It’s a device that calls into question the writer’s creativity and skill.

Deus ex machinas can also ruin the viewing experience. A Deus ex machina somewhat asks that viewers further their suspension of disbelief. This is something that is already inherent when watching films.

Since films are exaggerated versions of reality they can get away with certain things. Within the world of film, the rules are intrinsically different. Yet, when a Deus ex machina is introduced, and events occur with no rhyme or reason it can confuse and alienate audiences.

They can bring the audience out of the world that they’ve become invested in and inherently remind them that they’re watching a constructed reality.


Despite all the criticism and cons, there are times where a Deus ex machina can work.

Deus ex machinas can be pulled off if when accompanied by flashbacks or backstory. This can fill in the blanks that a Deus ex machina often creates. It is not a perfect solution, but it can work.

For example, The Sixth Sense might not strictly contain a Deus ex machina ending. But it’s an example of an ending that is built up to and makes sense in retrospect. The clues are there to pick over after the reveal.

Deus ex machinas can also be great for comedic effect. Movies like Shaun of The Dead, Monty Python’s Life of Brian, Bill and Ted’s Bogus Journey are a few examples of comedies where the plot device is used.

  • In Shaun of The Dead, as they travel out of the bar and onto the zombie-filled streets, they are prepared to fight to the death. Only they are saved by the military, even though it has not really been set up that the government was doing much to combat the zombie outbreak.
  • In Life of Brian, the main character Brian is saved from falling to his death by an alien spacecraft.
  • And in Bill and Ted’s Bogus Journey, intelligent aliens help Bill and Ted defeat evil robot versions of themselves.
Life of Brian Deus Ex Machina

Comedies often have an absurdist air about them. So, many of the events that happen in them are so removed from reality that using a Deus ex machina can add to the comedy and the craziness going on in the film.

Simply put, a Deus ex machina can work when writers put the time and effort in to make it work.

How to Avoid Using a Deus Ex Machina in Your Script

More often not, however, the use of a Deus ex machina should be avoided. This is especially true if it’s used as a quick fix and nothing more. But how do you avoid getting to this place in your script where there’s no other choice than to use a Deus ex machina?

1. Proper World Building

One of the ways to avoid a Deus ex machina is to make sure that the rules of your world are clear. That goes for all genres, from fantasy to historical films, and everything in between. World building is an intrinsic part of writing and knowing your world helps you avoid making leaps that are unconvincing to the audience.

If the rules of the world are apparent it is easier to avoid putting characters into impossible situations. There will be no need for any external force that does not fit within the rules of the world.

As you write you should make notes of things. You should also evaluate if they will lead you down a path where you end up with an ending that you cannot get out of. Writers tend to use a Deus ex machina when they have allowed their stories to become too contrived and complicated and need a simple way out.

Some writers strive to have so much drama and subplots that the web they weave cannot be untangled. If you feel like your story is becoming too complicated take a step back and get back to what the story is really about.

Again, this speaks to good world building. If you’re sure of the parameters of the world and its purpose, then it’s less likely you will reach for contrivance. Your world should be rich enough for you to mine for plot, themes and characters without creating impossible, forced situations.

LOTR Deus Ex Machina

2. Foreshadowing

Another way to avoid a Deus ex machina is to make sure you plant seeds throughout the story that foreshadow an ending. So, as you first start writing have your ending in mind.

Keep in mind, a Deus ex machina does not simply have to be a god or fantastical event. It could be as simple as a person pulling out a gun (where previously they’d never been seen with one) or having some expert ability that gets them out of trouble.

  • Say your character is surrounded by deadly assassins and it has been shown throughout the script that the character is not much of a fighter.
  • Then as the assassins close in, they suddenly take them all out with expert fighting skills.
  • This comes as a shock since these skills were never established earlier in the story.
  • However, if early on in the script, in the first act, for example, the character is shown demonstrating their fighting skills then their sudden use at the end will make sense.
  • Often this is most satisfying when unexpected. For example, the character demonstrates fighting skills in an innocuous, playful context. Then their deployment in a more serious context will be more unexpected.

You cannot introduce something at the end that saves the day out of nowhere. But you can easily mention things earlier in the script and hint at their ability for plot resolution. Be mindful as you write. There might be plenty of moments to foreshadow the key aspects of the plot resolution in some small minor way that feels unremarkable at the time.

Setting up the ending early on can make the outcome of the story that much more satisfying as the audience will realize they’ve been given clues to it all along. Clues they can retroactively piece together.

Top 10 Uses of Foreshadowing in Movies

In Conclusion: Deus Ex Machina, Friend or Foe?

When first starting out as a screenwriter it seems to be in your best interest to avoid a Deus ex machina. It can be nearly impossible to make this plot device work even for the most skilled writers. So particularly as a new writer, you want to demonstrate your skill at writing, rather than relying on easy and well-worn plot devices.

Sometimes if your story has led you to an ending that is hopeless then a Deus ex machina can work. They can save the story and the audience from hopelessness and widen the opportunity for the final, ultimate ending.

You want people to leave the film satisfied not scratching their heads. And you want to leave them fully convinced of the legitimacy of the story world you have built. This story and these characters need to feel real, as if they continue on outside the film after the audience has finished watching.

And a Deus ex machina, more often than not, can shatter the illusion of the story being a real and convincing world. You want to try and not remind the audience they’re watching something that has been painfully constructed, but instead let them sit comfortably in a believable and coherent narrative.

In Summary

What is a Deus Ex Machina?

Derived from the Latin meaning ‘god from machine’ a Deus ex machina is a plot device where a seemingly unsolvable problem is resolved by a sudden and unlikely solution.

Is a Deus Ex Machina Bad?

A Deus ex machina more often than not feels like lazy writing that seeks to solve a tricky problem in the plot with an easy and largely unexplained solution. It can take the audience out of the story by reminding them they are watching a contrived reality. However, in certain circumstances, such as in comedy or in a rich, well-built world a Deus ex machina can prove satisfying.

How to Avoid Using a Deus Ex Machina

The best way to avoid a Deus ex machina is to build your story world as richly as possible. This way, the audience will be happy to abide by the rules you have created for your story. In addition, foreshadowing can be a great way of taking the pressure off the ending, placing pieces of the ending throughout so that it doesn’t completely blindside the audience.

– What did you think of this article? Share ItLike It, give it a rating, and let us know your thoughts in the comments box further down…
– Struggling with a script or book? Story analysis is what we do, all day, every day… check out our range of script coverage services for writers & filmmakers.

This article was written by Cherrish Warnick and edited by IS staff.

Get *ALL* our FREE Resources

Tackle the trickiest areas of screenwriting with our exclusive eBooks. Get all our FREE resources when you join 60,000 filmmakers on our mailing list!

Success! Thanks for signing up, now please check all your email folders incl junk mail!

Something went wrong.

1 thought on “Deus Ex Machina: How to USE and/or AVOID in Screenwriting”

  1. I disagree with you on Signs. I think that the element of water was introduced early in the story and it links perfectly with the last words of the priest wife. At the end everything was a symbol, the water, the swing away, the kid with asthma. I think it’s a n excellent movie and I respect the writer’s style.


Leave a Comment


Get *ALL* our FREE Resources

Tackle the trickiest areas of screenwriting with our exclusive eBooks. Get all our FREE resources when you join 60,000 filmmakers on our mailing list!

Success! Thanks for signing up, now please check all your email folders incl junk mail!

Something went wrong.

Send this to a friend