The play opens at midnight. There is conflict between Denmark and Norway, whose soldiers are led by young Fortinbras. Members of the watch explain to Horatio that they have sighted a ghost who resembles the old king of Denmark. The ghost is, in fact, Hamlet's father. He explains to Hamlet that he has been murdered by his brother, Claudius (who has since married Hamlet's mother, Gertrude) and asks Hamlet to revenge his murder. Hamlet agrees, although he is clearly distressed by the thought of what has happened to his father, the fact that he feels his mother has betrayed his father, and the thought of what he will have to do.
Throughout the play, Hamlet spends much of his time debating with himself about how he should fulfil his father's request. He pretends to be mad. Although at some points in the play he is clearly sane, there are times when we might see him as genuinely mad. Claudius becomes suspicious of Hamlet and tension grows between Hamlet and his mother, who is torn between her son and her new husband. Claudius enlists the help of his advisor, Polonius, to spy on Hamlet. For this, they use Polonius's daughter, Ophelia, who appears to be the object of Hamlet's love. This leads to Hamlet rejecting Ophelia. Friends of Hamlet from university, Rosencrantz and Guildenstern, are also invited to the court by Claudius in order to help him uncover the reasons for Hamlet's melancholy.
When a group of actors (the Players) arrive at court, Hamlet seizes the opportunity to test the ghost's story. He arranges for the murder to be re-enacted on stage in 'The Mousetrap' so that he and Horatio can observe Claudius's response. As a result of what he sees, Hamlet contemplates murdering Claudius, but fails to carry it through because he does not want to give Claudius - who is praying - the chance of salvation which was denied his father. Ironically, the audience knows that Claudius cannot actually pray because he is not willing to give up what he has gained from the murder.
Hamlet now confronts his mother and attempts to persuade her of Claudius's guilt. During their meeting Hamlet mistakenly stabs Polonius, who has been sent to spy on them. Claudius is now very afraid of what Hamlet might do and arranges to send him to England, with Rosencrantz and Guildenstern, where he is to be executed. Fortunately, Hamlet discovers the plans and returns to Denmark, leaving Rosencrantz and Guildenstern to be executed in his place.
On his return, Hamlet finds that during his absence Ophelia has gone mad and killed herself out of grief. Her brother, Laertes, spurred on by Claudius, seeks his revenge - the death of Hamlet. A duel is arranged and Laertes, encouraged by Claudius, agrees to cheat by using an unprotected and poisoned sword. To make doubly sure, Claudius prepares a poison drink for Hamlet.
Prior to the duel, Hamlet and Laertes confront each other at Ophelia's graveside. The duel itself does not go according to plan: firstly Gertrude accidentally drinks from the poisoned cup; Laertes wounds Hamlet with the poisoned rapier, which he then loses to Hamlet in a scuffle; Hamlet wounds Laertes with the poisoned rapier. Gertrude dies, revealing that the cup is poisoned; Laertes dies, revealing Claudius's treachery and asking Hamlet's forgiveness. Hamlet takes his revenge by stabbing Claudius with the poisoned sword and forcing him to drink from the poisoned cup before he dies himself, naming Fortinbras as successor to the Danish throne. Horatio remains alive to tell the truth of what has happened.