"To be, or not to be" is a speech given by Prince Hamlet in the so-called "nunnery scene" of William Shakespeare's play Hamlet (Act 3, Scene 1). The speech is named for the opening phrase, itself among the most widely known and quoted lines in modern English literature, and has been referenced in many works of theatre, literature and music.
In the speech, Hamlet contemplates death and suicide, weighing the pain and unfairness of life against the alternative, which might be worse. It is not clear that Hamlet is thinking of his own situation since the speech is entirely in an abstract, somewhat academic register that accords with Hamlet's status as a (recent) student at Wittenberg University. Furthermore, Hamlet is not alone as he speaks because Ophelia is on stage waiting for him to see her, and Claudius and Polonius have concealed themselves to hear him. Even so, Hamlet seems to consider himself alone and there is no definite indication that the others hear him before he addresses Ophelia, so the speech is almost universally regarded as a sincere soliloquy.