Irony is commonly understood to be a moment when one thing is said, but another thing is meant. This most common form of irony is known as verbal irony and often recognized as sarcasm. However, in literature, we see irony presented in several forms. The most common form of irony we see Act 5 is situational as well as verbal irony. Situational irony is seen when an action takes place that is the complete opposite of what is expected.
One example of situational irony can be seen in Act 5, Scene 2 when Hamlet explains to Horatio how he managed to escape the trap that was set for him in England. While at sea, Hamlet found the letter the king had sent Rosencrantz and Guildenstern to England with ordering Hamlet's death upon their arrival. Instead, Hamlet wrote a new letter commissioning the deaths of Rosencrantz and Guildenstern and sealed it with his royal seal. This is a fine example of situational irony, especially from the perspective of the king, who expected Hamlet to never return from England. Another way in which this is an example of situational irony is that both Rosencrantz and Guildenstern were very close friends of Hamlet in school. Therefore, ironically, they accepted a commission from the king ordering his death, and, therefore, equally ironically, Hamlet ordered their deaths instead. The situational irony is seen in the double act of betrayal, as Hamlet points out himself in the lines:
Why, man, they did make love to this employment!
They are not near my conscience; their defeat
Does by their own insinuation grow. (V.2.61-63)
An instance of verbal irony can be seen in the gravedigger scene, Act 5, Scene 1. As the gravediggers are digging the grave for Ophelia, they question the fact that she is being given a "Christian burial." They comment on the fact the coroner has ruled that Ophelia accidentally drowned herself. However, the gravediggers actually believe that she had committed suicide. Any person guilty of suicide would not be given a Christian burial because suicide is one of the gravest of sins. The two gravediggers agree that, ironically, if Ophelia had not been a gentlewoman, she would have been pronounced as having willfully drowned herself and would not have been given a Christian burial. One gravedigger sarcastically comments that the nobility are given more privileges to sin than other Christians, as we see in his lines:
And the more pity that great folk should have countenance in this world to drown or hang themselves more than their even Christian. (V.i.25-27)
Since the gravedigger is sarcastically commenting on the unfair treatment of the noble class, we see that this is a perfect example of verbal irony. In addition, the fact that Ophelia is being given a Christian burial can also be recognized as situational irony because, just as the gravediggers point out, the situation is the exact opposite of what would be expected, since Ophelia did indeed drown herself.