The meaning of the “to be or not to be” speech in Shakespeare’s Hamlet has been given numerous interpretations, each of which are textually, historically, or otherwise based. In general, while Hamlet’s famous “to be or not to be" soliloquy questions the righteousness of life over death in moral terms, much of the speech’s emphasis is on the subject of death—even if in the end he is determined to live and see his revenge through.
Before engaging in the soliloquy itself, however, it is important to consider Hamlet’s lines that occur before the passage in question. In the first act of the play, Hamlet (full character analysis of Hamlet here)curses God for making suicide an immoral option. He states, “that this too solid flesh would melt, / Thaw, and resolve itself into a dew! / Or that the Everlasting had not fix’d / His canon ‘gainst self-slaughter! O God! God!" (I.ii.129-132). At this early point in the text it is clear that Hamlet is weighing the benefits versus drawbacks of ending his own life, but also that he recognizes that suicide is a crime in God’s eyes and could thus make his afterlife worse than his present situation. In essence, many of Hamlet’s thoughts revolve around death and this early signal to his melancholy state prepares the reader for soliloquy that will come later in Act III.
When Hamlet utters the pained question, “To be, or not to be: that is the question: / Whether ‘tis nobler in the mind to suffer / The slings and arrows of outrageous fortune / Or to take arms against a sea of troubles" (III.i.59-61) there is little doubt that he is thinking of death. Although he attempts to pose such a question in a rational and logical way, he is still left without an answer of whether the “slings and arrows of outrageous fortune" can be borne out since life after death is so uncertain.
At this point in the plot of Hamlet, he wonders about the nature of his death and thinks for a moment that it may be like a deep sleep, which seems at first to be acceptable until he speculates on what will come in such a deep sleep. Just when his “sleep" answer begins to appeal him, he stops short and wonders in another of the important quotes from Shakespeare’s Hamlet, “To sleep: perchance to dream:—ay there’s the rub; / For in that sleep of death what dreams may come" (III.i.68-69). The “dreams" that he fears are the pains that the afterlife might bring and since there is no way to be positive that there will be a relief from his earthly sufferings through death, he forced to question death yet again.
After posing this complex question and wondering about the nature of the great sleep, Hamlet then goes on to list many sufferings men are prone to in the rough course of life, which makes it seem as though he is moving toward death yet again. By the end of this soliloquy, however, he finally realizes, “But that dread of something after death, / The undiscover’d country, from whose bourn / No traveler returns—puzzles the will / And makes us rather bear those ills we have" (III.i.81-84). Although at this last moment Hamlet realizes that many chose life over death because of this inability to know the afterlife, the speech remains a deep contemplation about the nature and reasons for death.