Guarding the castle at Elsinore, Marcellus and Barnado tell Horatio that they have seen the ghost of the dead King Hamlet. The ghost reappears, and they decide they must tell the dead king's son, also called Hamlet, about it.
Hamlet is present at a reception being given by his uncle Claudius, who has just married Hamlet's mother, Gertrude. Claudius is sending ambassadors to Norway to stop a planned invasion by young Fortinbras. He gives Polonius' son Laertes permission to return to France.
Hamlet reflects on the hasty marriage, and learns of the ghost's visit. That night he meets the ghost, who reveals that King Hamlet was murdered by Claudius, and Hamlet willingly agrees to be the means of revenge. He warns Horatio and the others not to speak of what has happened, even if he should behave strangely. Polonius bids farewell to Laertes and warns his daughter Ophelia against Hamlet's courtship.
Later, she tells Polonius of a strange visitation by Hamlet, and Polonius reports to the King and Queen that rejected love is the cause of Hamlet's supposed madness. Hamlet's fellow-students Rosencrantz and Guildenstern arrive, invited by the King to find out what is wrong. Polonius arranges for Ophelia to meet Hamlet where he and Claudius can observe them.
Hamlet reflects to himself on the nature of life and death, then meets Ophelia. They argue about their relationship, and Hamlet, having become suspicious about being observed, tells her she should go to a nunnery. Claudius is convinced that love is not the cause of Hamlet's behaviour, and decides to send him abroad.
Meanwhile, travelling players have arrived, and Hamlet asks them to perform The Murder of Gonzago before the King, so that he and Horatio can judge Claudius' guilt by his reaction. Hamlet contrasts his own inaction with the way the players can become so involved in their characters. When one of the players enacts the poisoning of a king, Claudius leaves in high emotion, much to Hamlet's jubilation. Gertrude asks to see Hamlet, and Polonius decides to hide in the room to hear what is said. On his way, Hamlet comes across Claudius alone, trying to pray for forgiveness, but decides not to kill him in such a state of mind.
Hamlet arrives in his mother's room, and kills the person he discovers in hiding, thinking it to be Claudius but finding it to be Polonius. He argues fiercely with Gertrude, eventually persuading her to change her ways. The Ghost appears, restraining Hamlet's anger towards his mother, and reminding him of the need for revenge. Claudius instructs Rosencrantz and Guildenstern to take Hamlet immediately to England.
Travelling to the ship, Hamlet passes the Norwegian army on its way to fight for a small patch of land, and contrasts their determination with his own lack of resolve. Ophelia has descended into madness. Laertes returns, blaming Claudius for his father's death, and is incensed to see Ophelia in this state. Claudius persuades him that the blame is Hamlet's. When Claudius receives a letter from Hamlet reporting his return to Denmark, he plots with Laertes to kill him. They arrange a duel in which Laertes' sword will be unblunted and poisoned. Claudius will also poison a drink, which he will offer Hamlet. Gertrude arrives with the news that Ophelia has drowned.
Hamlet meets Horatio on returning to Elsinore. On the way, they see two Clowns digging a grave, and Hamlet talks to the First Clown, reflecting on the skulls he finds. They discover that the grave is for Ophelia. Hamlet reveals himself to the funeral party, grappling with Laertes and proclaiming his love for Ophelia.
Later, Hamlet tells Horatio how the trip to England was a subterfuge for his death, arranged by Claudius, and how he managed to escape. Osrick enters with news of the proposed fencing match, and Hamlet accepts the challenge.
With Hamlet in the lead, Gertrude toasts him, and drinks from the poisoned cup. Laertes wounds Hamlet with the poisoned rapier, and is then wounded with it by Hamlet. Before he dies, Laertes blames Claudius, and Hamlet kills the King.
Hamlet, close to death, passes the Danish succession to the Norwegian Fortinbras, and instructs Horatio to tell his story.