The Shakespeare play featuring the line “To be, or not to be” is Hamlet.
The line begins Prince Hamlet’s famous meditation on existence, death, and action in Act 3, Scene 1, often called the “nunnery scene.” Hamlet weighs the suffering of life against the unknown consequences of death, asking whether it is nobler to endure hardship or resist it.
The speech is frequently called a soliloquy, although Ophelia is present and Claudius and Polonius are concealed nearby. Its inward, philosophical style makes it one of the most recognized passages in English literature. The phrase has also become a general expression for a difficult choice between alternatives.
Hamlet exists in several early textual forms. The First Quarto appeared in 1603, the Second Quarto in 1604, and the First Folio in 1623. The wording and punctuation vary among these versions, but the opening question remains unmistakable. A common mix-up is confusing the speech with Hamlet’s later cemetery scene, where he encounters Yorick’s skull.