In Act 1, Scene 2, Hamlet and Claudius have an interaction that reveals the rising tension between them. The new king has made a speech to his subjects about the joy and sadness he feels in equal measure, having recently lost his brother but gained the throne and his brother’s widow. Claudius’s desire to move on from his brother’s death, as the audience will eventually discover, is motivated by his guilt over murdering for personal gain. He advises the assembled party to move into an atmosphere of celebration instead. As an extension of this attitude, he then criticizes Hamlet specifically for being overly mournful. Claudius says: "How is it that the clouds still hang on you?” Hamlet, in his response, makes a pun about the weather, saying:
“Not so, my lord; I am too much in the sun.”
Hamlet’s response uses verbal irony to push back against Claudius. His retort functions on multiple levels. Firstly, he seems to imply that the sunny disposition of those around him so soon after the death of his father is chafing at him. Hamlet is arguing that no one has seemed to mourn his father properly, and their cheeriness beats down on him as if he's standing in the blazing hot sun. His mother has remarried quickly, and the wedding has invoked a cheerful disposition in the subjects around him. More importantly, though, his response also seems to reject the idea that he is now Claudius’s "son." Hamlet uses the homophone "sun" to ironically comment on the fact that the King has called him "son" too frequently. This double response pushes back against Claudius’s initial comment and makes the tension between these two men clear even before the real source of animosity is revealed.
In Hamlet, instances of dramatic irony often come about as a result of Hamlet's tendency to only share certain motivations with the audience (and not with the other characters). For example, in Act 2, Scene 1, Ophelia and her father have a conversation about what they think is a change in Hamlet’s behavior. Ophelia has just had a frightening experience with Hamlet, and she is concerned that he has fallen mad or ill. In response, her father says:
This is the very ecstasy of love
Whose violent property fordoes itself
And leads the will to desperate undertakings
Polonius and Ophelia both conclude that Hamlet is behaving strangely because he has fallen madly in love with Ophelia. Because Polonius had previously encouraged Ophelia to spurn Hamlet’s advances, they see his behavior as evidence that he has become more invested. However, the audience has knowledge that Polonius and Ophelia don’t, and their understanding of Hamlet’s behavior creates tension in the scene.
Earlier in the play, Hamlet vows to start acting crazy, and the audience therefore understands that the source of his anger and confusion is the news that his father was murdered. His attempts to conceal his knowledge from the other characters in the play create dramatic irony, when the audience understands things about Hamlet’s behavior that other characters cannot. The dramatic irony is important to this scene because it fosters an environment in which dangerous misunderstandings can take place. Most of the dramatic irony in Hamlet stems from his decisions to conceal his real mental state from those around him. That lack of clarity also affects the audience and makes it difficult to determine what is actually motivating Hamlet.
A good example of the play's use of dramatic irony comes in Act 3, Scene 4, which is a significant turning point in the play. Driven by the escalation of tension, Hamlet arrives to confront his mother. Shortly into their conversation, when she begins to feel threatened, the Queen calls for help, and Hamlet realizes that someone is standing behind the curtain. The audience knows that Polonius is behind the curtain, but Hamlet doesn't, and without knowing who stands there, he kills him. The queen reacts with horror:
Queen: O me, what hast thou done?
Hamlet: Nay, I know not. Is it the King?
Queen: O, what a rash and bloody deed is this!
In this scene, dramatic irony is created by the fact that the Queen and the audience know that Polonius is behind the curtain, but Hamlet doesn’t know the identity of the "rat." Therefore, the audience realizes that Polonius is dead before Hamlet does. This is an important moment in the play because Hamlet’s action is the first decisive thing he has done in an effort to avenge his father and himself. Once he discovers that he has killed Polonius, his sense of right and wrong becomes further clouded. Immediately after, he is visited by the ghost, and Elsinore slips further into madness.
Hamlet’s last soliloquy takes place in Act 4, Scene 4. Like his previous moments of pause, Hamlet uses the privacy of an empty stage to reflect on his behavior. By this point in the play, he has begun to understand a frustrating pattern in his behavior: he is paralyzed by his fear of making a decision, and he agonizes over what to do until any action seems impossible. In his soliloquy in Act 4, Scene 4, he addresses this pattern directly. He says:
Now whether it be Bestial oblivion or some craven scruple
Of thinking too precisely on th’ event
(A thought which, quartered, hath but one part wisdom
And ever three parts coward), I do not know
Why yet I live to say “This thing’s to do,"
Hamlet is spurring himself toward revenge, and in doing so, he is very critical of himself. He calls himself a coward, and bemoans his tendency to overthink. Having access to his mental state at this moment in the play allows the audience to contextualize his future actions. This is his last soliloquy and therefore the last moment the audience sees him express his true thoughts. This is therefore the end of his solo reflection, and his conclusion is to head further into the violence and chaos that are present in the play’s conclusion. The irony inherent in this scene—that Hamlet has begun a monologue about his frustrating tendency to talk instead of act—makes his situation seem even more helpless. He is unable to change his nature, and spends this last moment before the audience cursing himself for it.
In Act 5, Scene 2, there is a violent altercation between Laertes and Hamlet. The final events of the play take place as the other characters gather to spectate, and these moments contain dramatic irony.
As is the case with many of the scenes in which groups of characters are present, the question of what information is known by whom becomes very relevant. In this case, the secrets kept have deadly consequences. Ultimately, it is a scene of great violence, and nearly everyone present dies. But before the characters gather, the audience watches as the King poisons the cup with the intention of killing Hamlet. What's more, Laertes has already vowed to enhance his odds in the duel by poisoning the tip of his sword, saying "I'll touch my point / With his contagion, that if I gall him slightly / It may be death." Because of this information, the play's final scene is rife with dramatic irony, as the audience knows important details that not all of the characters are aware of.
This use of dramatic irony makes the audience feel powerless as they watch the various characters unknowingly stumble into their own deaths. The senselessness of the violence is exacerbated by the fact that the audience can anticipate it. This is at its most extreme when the Queen accidentally poisons herself:
Queen: He’s fat and scant of breath.—Here, Hamlet, take my napkin; rub thy
brows. The Queen carouses to thy fortune, Hamlet.
Hamlet: Good madam.
King: Gertrude, do not drink.
Queen: I will, my lord; I pray you pardon me.
The audience and the King know that the Queen’s death is imminent even before the Queen herself knows it. This instance of dramatic irony thus ratchets up the sense of suspense and anticipation, as the audience helplessly watches the Queen walk into a trap.