Something is amiss in Denmark -- for two successive nights, the midnight guard has witnessed the appearance of the ghost of Old Hamlet, the former King of Denmark who has recently died. The guards bring Horatio, a learned scholar and friend of Hamlet, Prince of Denmark, to witness this apparition. Though skeptical at first, Horatio sees the ghost and decides to report its appearance to Hamlet.
Meanwhile, a new king of Denmark has been crowned: Claudius, Old Hamlet's brother. Claudius has taken Old Hamlet's widow, Gertrude, as his wife. We watch their marriage celebration and hear about a threat from the Prince of Norway, Fortinbras, which Claudius manages to avoid by diplomacy. Hamlet is in attendance at this wedding celebration; he is hardly in joyous spirits, however. He is disgusted by his mother's decision to marry Claudius so soon after his father's demise. Horatio tells Hamlet of the appearance of the ghost and Hamlet determines to visit the spirit himself.
Meanwhile, the court adviser, Polonius, sends his son, Laertes, back to Paris, where he is living. Laertes and Polonius both question Ophelia (sister and daughter, respectively) about her relationship with Hamlet. Ophelia admits that Hamlet has been wooing her. They tell her to avoid Hamlet and reject his amorous advances, emphasizing the importance of protecting her chastity. Ophelia agrees to cut off contact.
That night, Hamlet accompanies the watch. The ghost appears once more. Hamlet questions the ghost, who beckons Hamlet away from the others. When they are alone, the ghost reveals that Claudius murdered him in order to steal his crown and his wife. The ghost makes Hamlet promise to take revenge on Claudius. Hamlet appears to concur excitedly. He has Horatio and the guards swear not to reveal what they have seen.
Act Two finds us some indefinite time in the future. Hamlet has been behaving in a most erratic and alarming way. Claudius summons two of Hamlet's school friends, Rosencrantz and Guildenstern, in order to discover the meaning of this strange behavior. Rosencrantz and Guildenstern's attempts to discover the reason for Hamlet's madness are met with evasion and witticism. Meanwhile, Polonius hatches a theory of his own: he thinks that Hamlet is insane due to Ophelia's rejection of his love. He arranges to test his theory by setting Ophelia on Hamlet when they are apparently alone and then observing the proceedings with Claudius.
Hamlet's only consolation appears to be the coming of a troupe of players from England. Hamlet asks the player's whether they could play a slightly modified version of a tragedy. We realize that Hamlet plans to put on a play that depicts the death of his father, to see whether Claudius is really guilty, and the ghost is really to be trusted.
In Act Three, Ophelia approaches Hamlet when they are apparently alone; Claudius and Polonius hide behind a tapestry and observe. Hamlet behaves extremely cruelly toward Ophelia. The king decides that Hamlet is not mad for love of her but for some other hidden reason.
Hamlet prepares to put on his play, which he calls "The Mouse Trap." After instructing the players in their parts, Hamlet retires to the audience, where Claudius, Gertrude, Ophelia, and Polonius have gathered, along with many others. In the course of the play, both Gertrude and Claudius become extremely upset, though for different reasons. Gertrude is flustered by Hamlet's veiled accusation that she was inconstant and hypocritical for remarrying after Old Hamlet's death; Claudius is shaken because he is indeed guilty of his brother's murder. Claudius decides that he must get rid of Hamlet by sending him to England.
Following the play, Gertrude calls Hamlet to her room, intending to berate him for his horrible insinuations. Hamlet turns the tables on her, accusing her of a most grotesque lust and claiming that she has insulted her father and herself by stooping to marry Claudius. In the course of their interview, Polonius hides behind a tapestry; at one point, he thinks that Hamlet is going to attack Gertrude and cries for help. Hamlet stabs Polonius through the tapestry, thinking he has killed Claudius. When he finds that he has merely killed a "rash, intruding fool," Hamlet returns to the business of "speaking daggers" to his mother. Just as Gertrude appears convinced by Hamlet's excoriation, the ghost of Old Hamlet reappears and tells Hamlet not to behave so cruelly to his mother, and to remember to carry out revenge on Claudius. Gertrude perceives her son discoursing with nothing but air and is completely convinced of his madness. Hamlet exits her room, dragging the body of Polonius behind him.
After much questioning, Claudius convinces Hamlet to reveal the hiding place of Polonius' body. He then makes arrangements for Hamlet to go to England immediately, accompanied by Rosencrantz and Guildenstern. Claudius writes a letter to the English court asking them to kill Hamlet immediately upon his arrival and places the letter with his two cronies. On their way to the ship, Hamlet and his entourage pass Fortinbras' Norwegian army en route to a Polish campaign.
Back at Elsinore (the Danish palace), Ophelia has gone mad following her father's death. She sings childish and bawdy songs and speaks nonsensically. Laertes soon returns to Denmark with a mob in tow, demanding an explanation of Polonius' death. Claudius gingerly calms the young man and convinces him that Hamlet was the guilty party.
Letters arrive attesting to a strange turn of fortunes on the sea. Hamlet's ship to England was attacked by pirates, who captured Hamlet and arranged to return him to Denmark for a ransom. Hamlet sends Claudius an aggravating letter announcing his imminent return. Claudius and Laertes decide that Hamlet must be killed. They decide to arrange a duel between Laertes and Hamlet in which Laertes' sword is secretly poisoned so as to guarantee Hamlet's immediate death. As backup, Claudius decides to poison a cup of wine and offer it to Hamlet during the contest.
Just as Act Four comes to a close, more tragic news arrives. Gertrude says that Ophelia has drowned while playing in a willow tree by the river.
Act Five begins at a graveyard. Two gravediggers joke about their morbid occupation. Hamlet and Horatio arrive and converse with them. Soon, Ophelia's funeral begins. Because there are doubts about whether Ophelia died accidentally or committed suicide, her funeral lacks many of the customary religious rites. Laertes bombastically dramatizes his grief, prompting Hamlet to reveal himself and declare his equal grief at the loss of his erstwhile beloved. After a short tussle, Hamlet and Laertes part.
Later, Hamlet explains to Horatio that he discovered Claudius' plot to have him killed in England and forged a new letter arranging for the deaths of Rosencrantz and Guildenstern. While they are conversing, Osric, a ridiculous courtier, approaches and proposes the duel between Laertes and Hamlet. Hamlet eventually accepts this challenge.
The duel begins with Osric as referee. Hamlet wins the first two passes, prompting Claudius to resort to the poisoned drink. Hamlet refuses the drink. In his stead, Gertrude drinks a toast to her son from the poisoned cup. After a third pass also goes to Hamlet, Laertes sneak-attacks the prince and wounds him. A scuffle ensues in which Hamlet ends up with Laertes' sword. He injures Laertes. Just then Gertrude collapses. She declares that she has been poisoned. Laertes, also dying, confesses the whole plot to Hamlet, who finally attacks Claudius, stabbing him with the poisoned sword and then forcing the poisoned drink down his throat. Hamlet too is dying. He asks Horatio to explain the carnage to all onlookers and tell his story. Hamlet dies.
Just then, Fortinbras arrives at the court, accompanying some English ambassadors who bring word of the death of Rosencrantz and Guildenstern. With all the immediate royalty of Denmark dead, Fortinbras asserts his right to the crown. He arranges for Hamlet to receive a soldier's burial.