In Elsinore, in Denmark, the king has recently died, his brother Claudius holds the throne and has married the widow, Gertrude, and Prince Hamlet, who studied at Wittenberg, is kept at court. An apparition with the dead king's face walks the battlements and tells the prince that he was murdered and that he must avenge him. The play follows, over five acts, what Hamlet does and fails to do with this command, and how the delay drags the whole court along.
Act I
On a freezing night, the sentinels and Horatio, Hamlet's friend, see the Ghost, in the armor of the dead king, and decide to tell the prince everything (scene 1 of Act I). At court, Claudius announces his marriage to Gertrude, asks Hamlet to put aside his mourning and not return to Wittenberg, and Hamlet, alone, laments the haste of the marriage (scene 2 of Act I). Laertes leaves for France after warning his sister, Ophelia, that the prince's love is fleeting, and their father, Polonius, forbids his daughter to speak with Hamlet again (scene 3 of Act I). Hamlet follows the Ghost along the battlements (scene 4 of Act I) and hears from it that he was poisoned by Claudius, who poured poison into his ear as he slept in the orchard, and that he must be avenged, with Gertrude spared. Hamlet swears, makes his friends swear silence on the sword, and warns that he will feign madness (scene 5 of Act I).
Act II
Polonius sends a spy to Paris to watch Laertes, and concludes, from Ophelia's frightened account of the prince's disheveled, silent visit, that Hamlet has gone mad with love (scene 1 of Act II). Claudius and Gertrude summon Hamlet's childhood friends, Rosencrantz and Guildenstern, to sound him out, while Polonius reads the king a love letter from the prince and proposes spying on him with Ophelia. Hamlet mocks Polonius, gets the friends to admit they were summoned, and welcomes a company of actors, asking them for a speech about Pyrrhus and Priam and for The Murder of Gonzago. Alone, he rebukes his own inaction and decides to test the king through the theater (scene 2 of Act II).
Act III
Claudius and Polonius hide to spy on Hamlet's meeting with Ophelia. Hamlet enters speaking to himself about living and dying, treats Ophelia harshly and sends her to a nunnery, and Claudius, convinced that this is not love, decides to send him to England (scene 1 of Act III). In the play staged before the court, the actor pours poison into the sleeping king's ear, Claudius rises and leaves, and Hamlet becomes convinced of his guilt (scene 2 of Act III). Alone, the king confesses the crime and tries to pray, but cannot while he keeps the crown and the queen, and Hamlet, who finds him on his knees, spares him so as not to send him to heaven (scene 3 of Act III). In the queen's chamber, Hamlet runs his sword through the curtain behind which Polonius was hiding, scolds his mother before the portraits of her two husbands, sees the Ghost, which Gertrude does not see, and drags the body away (scene 4 of Act III).
Act IV
Gertrude tells Claudius that Hamlet has killed Polonius, and the king decides to ship him to England (scene 1 of Act IV). Hamlet hides the body and answers Rosencrantz and Guildenstern in riddles (scene 2 of Act IV), and the king, who sends him to England and reveals alone that the letters to the English king call for the prince's death (scene 3 of Act IV). On a plain, Hamlet sees Fortinbras's army march over a patch of land of no value and reproaches himself for not avenging his father (scene 4 of Act IV). Ophelia goes mad and sings about her dead father and lost love, and Laertes, back from France, storms the castle demanding satisfaction, until he agrees to hear Claudius out (scene 5 of Act IV). Horatio receives a letter from Hamlet, who was taken prisoner by a pirate ship and then returned to Denmark (scene 6 of Act IV). Claudius arranges with Laertes a duel in which Laertes's sword will have a poisoned tip, with a poisoned cup held in reserve, and Gertrude announces that Ophelia has drowned in a stream (scene 7 of Act IV).
Act V
In the graveyard, two gravediggers dig Ophelia's grave, Hamlet holds the skull of Yorick, the jester of his father, and the girl's funeral procession arrives. Laertes leaps into the grave, Hamlet reveals himself and jumps in after him, and the two fight until they are separated (scene 1 of Act V). Hamlet tells Horatio that he switched the letter ordering his death on the ship for another that condemns Rosencrantz and Guildenstern, and he accepts the duel with Laertes. Gertrude drinks the poisoned wine, Laertes wounds Hamlet with the poisoned sword and, after the weapons are swapped, is wounded by Hamlet with the same sword. Laertes accuses the king, and Hamlet thrusts the blade into him and makes him drink the wine, asks Horatio to tell his story, hears Fortinbras's cannons, names him as successor, and, after saying that the rest is silence, dies. Fortinbras, arriving at the castle, finds the royal family dead and orders four captains to carry Hamlet, like a soldier, to the stage (scene 2 of Act V).