Prince Hamlet is depressed. Having been summoned home to Denmark from school in Germany to attend his father's funeral, he is shocked to find his mother Gertrude already remarried. The Queen has wed Hamlet's Uncle Claudius, the dead king's brother. To Hamlet, the marriage is "foul incest." Worse still, Claudius has had himself crowned King despite the fact that Hamlet was his father's heir to the throne. Hamlet suspects foul play.
When his father's ghost visits the castle, Hamlet's suspicions are confirmed. The Ghost complains that he is unable to rest in peace because he was murdered. Claudius, says the Ghost, poured poison in King Hamlet's ear while the old king napped. Unable to confess and find salvation, King Hamlet is now consigned, for a time, to spend his days in Purgatory and walk the earth by night. He entreats Hamlet to avenge his death, but to spare Gertrude, to let Heaven decide her fate.
In order to test the Ghost's sincerity, Hamlet enlists the help of a troupe of players who perform a play called The Murder of Gonzagoto which Hamlet has added scenes that recreate the murder the Ghost described. Hamlet calls the revised play The Mousetrap, and the ploy proves a success. As Hamlet had hoped, Claudius' reaction to the staged murder reveals the King to be conscience-stricken. Claudius leaves the room because he cannot breathe, and his vision is dimmed for want of light. Convinced now that Claudius is a villain, Hamlet resolves to kill him. But, as Hamlet observes, "conscience doth make cowards of us all."
In his continued reluctance to dispatch Claudius, Hamlet actually causes six ancillary deaths. The first death belongs to Polonius, whom Hamlet stabs through a wallhanging as the old man spies on Hamlet and Gertrude in the Queen's private chamber. Claudius punishes Hamlet for Polonius' death by exiling him to England. He has brought Hamlet's school chums Rosencrantz and Guildenstern to Denmark from Germany to spy on his nephew, and now he instructs them to deliver Hamlet into the English king's hands for execution. Hamlet discovers the plot and arranges for the hanging of Rosencrantz and Guildenstern instead. Ophelia, distraught over her father's death and Hamlet's behavior, drowns while singing sad love songs bemoaning the fate of a spurned lover. Her brother, Laertes, falls next.
Laertes, returned to Denmark from France to avenge his father's death, witnesses Ophelia's descent into madness. After her funeral, where he and Hamlet come to blows over which of them loved Ophelia best, Laertes vows to punish Hamlet for her death as well.
Unencumbered by words, Laertes plots with Claudius to kill Hamlet. In the midst of the sword fight, however, Laertes drops his poisoned sword. Hamlet retrieves the sword and cuts Laertes. The lethal poison kills Laertes. Before he dies, Laertes tells Hamlet that because Hamlet has already been cut with the same sword, he too will shortly die. Horatio diverts Hamlet's attention from Laertes for a moment by pointing out that "The Queen falls."
Gertrude, believing that Hamlet's hitting Laertes means her son is winning the fencing match, has drunk a toast to her son from the poisoned cup Claudius had intended for Hamlet. The Queen dies.
As Laertes lies dying, he confesses to Hamlet his part in the plot and explains that Gertrude's death lies on Claudius' head. Finally enraged, Hamlet stabs Claudius with the poisoned sword and then pours the last of the poisoned wine down the King's throat. Before he dies, Hamlet declares that the throne should now pass to Prince Fortinbras of Norway, and he implores his true friend Horatio to accurately explain the events that have led to the bloodbath at Elsinore. With his last breath, he releases himself from the prison of his words: "The rest is silence."
The play ends as Prince Fortinbras, in his first act as King of Denmark, orders a funeral with full military honors for slain Prince Hamlet.