Dramatic irony in literature occurs when the audience understands or is aware of something but the character(s) are not clued in.
In Macbeth, the play begins, continues, and ends with dramatic irony. Consider the witches' prophecies in Act 1, Scene 3:
“All hail, Macbeth! that shalt be king hereafter.”
Macbeth will be king, all right, but surely his reign is not the glorious experience he had expected. Thinking about audiences in Shakespeare's day, they would have already been wary of the witches as soon as the Weird Sisters appeared. They knew that nothing good could come from evil. The murder of Duncan in order for Macbeth to ascend the throne is the evil that results from Macbeth's lust for power and his belief that he is fulfilling his destiny.
There are hints throughout Act 2 that things are not going as planned, but the audience sees it more clearly than do the characters. By Act 3, Lady Macbeth is starting to catch on. She tells her treacherous husband:
Nought’s had, all’s spent. Where our desire is got without content: ’Tis safer to be that which we destroy than, by destruction, dwell in doubtful joy.
The joy is "doubtful" because the spoils of the kingdom are spoiled; the throne was won through bloody murder, not divine right, not by just means.
Dramatic irony is also present in the references to water and guilt. While it would be hundreds of years before Carl Jung, the renowned psychoanalyst postulated his theories of archetypes, Shakespeare seemed to intuit those theories. Water, according to Jung, is symbolic the collective unconscious, of birth and death, and of purification and redemption.
In Act 2, after the murder of Duncan, Macbeth exclaims,
Will all great Neptune’s ocean wash this blood clean from my hand?
Neptune, of course, was the god who ruled the oceans, but interestingly, he is associated more in Roman mythology with fresh water than sea water. This "fresh water" is symbolic of Macbeth's hopes to be "purified" and "redeemed" but the audience is aware that there will be no forgiveness for the corrupt king.
Lady Macbeth, too, uses the archetype of water for her own complicity in the evil deeds. After Macbeth's Neptune plea, his wife replies in a dismissive way,
A little water clears us of this deed.
Again, the audience is aware that such a heinous crime will not so easily be dismissed, and they, of course, are correct. Later, Lady Macbeth's "collective unconscious," her guilt, consumes her. In her infamous sleepwalking scene, we see her desperately trying to "purify" herself of her crimes:
Out, damned stop! out I say! ...
What, will these hands ne’er be clean?...
Here's the smell of blood still. All the
perfumes of Arabia will not sweeten
this little hand. O, O!
From beginning to end, the audience knows that the Macbeths will achieve their bloody ambition, but they will not be happy, they will not enjoy their ill-gotten throne, and that they will never be free of the guilt spawned from their despicable crimes.