The Tragedy of Hamlet, Prince of Denmark, often shortened to Hamlet (/ˈhæmlɨt/), is a tragedy written by William Shakespeare at an uncertain date between 1599 and 1602. Set in the Kingdom of Denmark, the play dramatises the revenge Prince Hamlet is instructed to enact on his uncle Claudius. Claudius had murdered his own brother, Hamlet's father King Hamlet, and subsequently seized the throne, marrying his deceased brother's widow, Hamlet's mother Gertrude.
Hamlet is Shakespeare's longest play and among the most powerful and influential tragedies in English literature, with a story capable of "seemingly endless retelling and adaptation by others." The play seems to have been one of Shakespeare's most popular works during his lifetime and still ranks among his most-performed, topping the performance list of the Royal Shakespeare Company and its predecessors in Stratford-upon-Avon since 1879. It has inspired writers from Goethe and Dickens to Joyce and Murdoch, and has been described as "the world's most filmed story after Cinderella".
The story of Hamlet ultimately derives from the legend of Amleth, preserved by 13th-century chronicler Saxo Grammaticus in his Gesta Danorum, as subsequently retold by 16th-century scholar François de Belleforest. Shakespeare may also have drawn on an earlier (hypothetical) Elizabethan play known today as the Ur-Hamlet, though some scholars believe he himself wrote the Ur-Hamlet, later revising it to create the version of Hamlet we now have. He almost certainly created the title role for Richard Burbage, the leading tragedian of Shakespeare's time. In the 400 years since, the role has been performed by highly acclaimed actors from each successive age.
Three different early versions of the play are extant, the First Quarto (Q1, 1603), the Second Quarto (Q2, 1604), and the First Folio (F1, 1623). Each version includes lines, and even entire scenes, missing from the others. The play's structure and depth of characterisation have inspired much critical scrutiny. One such example is the centuries-old debate about Hamlet's hesitation to kill his uncle, which some see as merely a plot device to prolong the action, but which others argue is a dramatisation of the complex philosophical and ethical issues that surround cold-blooded murder, calculated revenge, and thwarted desire. More recently, psychoanalytic critics have examined Hamlet's unconscious desires, and feminist critics have re-evaluated and rehabilitated the often maligned characters of Ophelia and Gertrude.