Hamlet opens at night on the battlements of Elsinore castle, where a ghost in the form of the recently dead King Hamlet appears to soldiers and then to Prince Hamlet. The ghost identifies itself as the murdered king and commands his son to take revenge on Claudius, the king's brother, who poured poison into the sleeping king's ear, stole the crown, and married the widow Gertrude. Hamlet swears to remember and act, but immediately resolves to feign madness as a cover while he confirms the truth of the ghost's accusation.
The middle acts show Hamlet circling the problem. He organises a travelling company of players to re-enact the poisoning in front of Claudius, a play he calls 'The Mousetrap,' and reads the king's guilty reaction as confirmation of the ghost's word. Yet even then he does not act: encountering Claudius alone and apparently at prayer, he reasons that killing a man mid-repentance would send him to heaven rather than damnation, and passes up the moment. Instead he confronts his mother in her chamber, kills Polonius through an arras by mistake, and is shipped to England, with secret orders for his execution, by a king now openly alarmed.
The great soliloquies form the interior argument of the play. 'To be, or not to be' does not debate suicide in isolation; it examines why human beings endure so much wrong rather than end their suffering. The answer, 'the dread of something after death, / The undiscover'd country,' connects it to the play's widest question about what lies beyond the visible world and whether the ghost's testimony can be trusted at all. Hamlet's self-reproach in other soliloquies is equally searching: he marvels at an actor weeping for a fictional Hecuba while he, with a real murdered father, does nothing.
Laertes returns from France furious at his father's death and his sister's madness, and Claudius channels that fury into a plan: a fencing match in which Laertes will use an unbated, poisoned sword, with a poisoned cup as backup if the sword fails. Ophelia drowns in a brook before the match, 'chaunted snatches of old tunes, / As one incapable of her own distress,' the flowers she gathered spreading around her. The gravediggers' scene, darkly comic and the only extended relief in Act V, frames the final catastrophe with bones and epitaphs.
The fencing match kills four people in minutes. Gertrude drinks the poisoned cup by accident. Laertes wounds Hamlet with the poisoned rapier; in a scuffle, the swords are exchanged and Hamlet wounds Laertes with the same blade. Laertes, dying, names the king as the author of the treachery. Hamlet at last stabs Claudius and forces the remaining poison down his throat. He dies asking Horatio to live long enough to 'report me and my cause aright / To the unsatisfied.' Fortinbras, a Norwegian prince who has been circling Denmark throughout, arrives to find a stage full of corpses and claims the kingdom. The play ends with military honours for Hamlet, a soldier's funeral for a man who never quite fought his war.