There are three primary types of irony, of which dramatic irony is one.
Situational irony is the most common application of the word “irony.” It is when you expect one thing and get the opposite.
Irony is an oft-misunderstood concept, however, and people often use the word “ironic” when they mean “coincidental,” as in, “Wasn’t it ironic that we both showed up at the party wearing a Richard Nixon mask?” No, that is not ironic. It is a (great) coincidence.
Verbal irony is someone says one thing but means the opposite. Sarcasm is probably the most common form of verbal irony. When she told me, “Well, aren’t you Mister Wonderful,” I don’t think she meant that I was wonderful.
Dramatic irony occurs when the reader or the audience knows more about a situation than the characters in a book, movie, or show do. This creates tension for the audience or reader. In a horror movie, dramatic irony might be the presence of a scary monster unbeknownst to the hero but that the audience is nail-bitingly aware of.
In a comedy, dramatic irony might be in the form of a misunderstanding between characters that creates a comedic situation.
In Shakespeare’s A Midsummer’s Night’s Dream, for instance, the fairy Puck magically changes Bottom’s head into that of a donkey. The change is obvious to the audience and to a majority of of the characters, but Bottom is blissfully unaware of it, giving rise to the comedy of the situation. Anyone raised on 1970s sitcoms (i.e.: Three’s Company), as I was, will recall that they were built on dramatic irony.
Of course, sometimes dramatic irony leads not to comedy but to tragedy, as in Romeo and Juliet, in which Romeo finds Juliet apparently dead. The audience is aware that Juliet has taken a potion to feign death, but Romeo, berieved to find his love this way, instantly commits suicide.
Examples of dramatic irony in contemporary literature:
In The Curious Incident of the Dog in the Night-Time, Ed is desperately trying to find Christopher, unaware that Christopher is purposefully hiding from him.
The Time Traveler’s Wife is rife with dramatic irony, since from the start we know that Henry is a time traveler and that Clare is his life’s love. They aren’t aware of that, and of course, as a child, Clare is utterly unaware that Henry is her future lover.
An example of dramatic irony in Kurt Vonnegut’s Slaughterhouse-Five occurs when an English character, describing the move of American prisoners to the city, says, “You needn’t worry about bombs, by the way. Dresden is an open city. It is undefended, and contains no war industries or troop concentration of any importance.” Billy Pilgrim has previously referenced the bombing of Dresden multiple times at this point.
In Harry Potter and the Sorcerer’s Stone, Hermione goes into the girls’ bathroom not knowing that there is a twelve-foot mountain troll in there. However we, the readers, know about the troll. This is dramatic irony of the scary – there’s a monster in the other room – variety.