a literary technique, originally used in Greek tragedy, by which the full significance of a character's words or actions is clear to the audience or reader although unknown to the character.
The basic meaning of irony is the difference between how things seem to be and the reality. As a literary technique it is used when a certain outcome is revealed, but is not what readers were expecting or hoping for. Irony can be difficult to define; it's often subjective and depends on the audience's expectations.
Example:
Dramatic Irony in Romeo and Juliet
In the final act of this archetypal love story, Shakespeare employs dramatic irony to keep the audience on the edge of their seats.
Friar Laurence sends a messenger to tell Romeo about Juliet’s plan to drug herself into deathlike coma. We watch in horror as the messenger fails to deliver this vital piece of information. And though we know that Juliet is not really dead, we see Romeo poison himself because he cannot live without her.