First of all, allow me to clarify that there are several interpretations to this famous soliloquy (that is, a sort of monologue in which the character is alone on the stage and the audience has direct access to the mind of Hamlet, in this case). I will provide the most well known explanation to these words.
Background information:
Hamlet's father is dead, as a rusult, Hamlet (son) is very depressed. On top of that, he believes that his uncle Claudius (the current king) killed his own father, so he apparently goes crazy trying to prove that Claudius is guilty, although he is not completly certain yet.
Answer
Shakespeare makes Hamlet reflect upon the meaning of life (or rather how meaningless life can be). It's interesting that Hamlet doesn't say this from a personal point of view, he speaks in general and we a can all empathize with his words.
In this soliloquy Hamlet reflects upon the options he has before him, life vs death/existence vs non-existence, these can be said to be the backbone of this speech, everything goes around whether it is more important to be alive or not, to do something against what is unfair or not. We notice a lot of hesitation in Hamlet, but at the same time this speech provides a beautiful metaphor regarding "death", when he compares it to "dreaming".
By the end of this soliloquy, he ends up believing that thinking too much makes you a coward. This is important because in this play "THOUGHT" vs "ACTION" are too topics that are constantly at work.
Below you can find a more detailed explanation:
- To be or not to be: that is the question:
The real issue is: to be alive or to be dead? to actually exist in this world or to stop existing? Take into account that Hamlet thinks a lot in his actions...
- Whether 'tis nobler in the mind to suffer the slings and arrows of outrageous fortune or to take arms against a sea of troubles, and by opposing end them?
In this sentence Hamlet continues proposing two ideas from which he has to choose: Is it more honorable to suffer because of your fate (to accept your destiny) or to fight against each and one of your problems (to rebel against your fate)?
- -To die, -to sleep,- no more; and by a sleep to say we end the heartache, and the thousand natural shocks that flesh is heir to, -'tis a consummation devoutly to be wish'd.
Another option he contemplates, "to die" which is similar to "sleep", and when you sleep, headaches, and all natural pains that chain our bodies dissapear, that is an ending that everybody would wish.
- To sleep: perchance to dream: -ay, there's the rub; for in that sleep of death what drems may come,
Now he further develops the metaphore of "death - sleep" by stating that maybe dying is like dreaming. That's the issue though, for when we sleep (die) we dont' know what the dreams will be about, and we don't know whether we'll be dreaming or not.
- When we have shuffled off this mortal coil, must give us pause: there's the respect that makes calamity of so long life; for who would bear the whips and scorns of time, the oppressor's wrong, the proud man's contumely, the pangs of despis'd love, the law's delay, the insolence of office and the spurns that patient merit of the unworthy takes, when he himself might his quietus make with a bare bodkin?
When we die we leave behind all our worries and problems, to expirience a "pause"; that's what makes life so long, the fact that you have to endure problems and the "scorns" of time. He provides a list of them: when a superior treats you unfairly, when someone doesn't love you back, the delay of justice and so on, who can bear all this stuff?
- Who whould these fardels bear, to grunt and sweat a weary life, but that the dread of something after death, -the undiscover'd country, from whose bourn no traveller returns, -puzzles the will and makes us rather bear those ills we have than fly to others that we know not of?
We support all these problems because we are afraid of what comes "after death" = "the undiscovered country" from where no one has returned, this confuses us and forces us to support all our worries and burdens because we are afraid to face the aftermath, we prefer to be on earth with people who are not so good, than to go with others that we don't really know.
- And thus the native hue of resolution is sicklied o'er with the pale cast of thought, and enterprises of great pith and moment, with this regard, their currents turn awry, and lose the name of action
Our thoughts hinder our actions, we think and think but we do nothing, because we are filled with cowardice.