The death penalty is inherently flawed because of its irrevocability. There is no way to be absolutely, mathematically certain that a person has committed the crime for which they are being executed. Even confessions can be lies or delusions. Even eyewitnesses can err. Even DNA evidence can be flawed. While a convicted criminal is adequately incarcerated, the public is insulated from any further crimes and needn't fear for their safety. There is no need to execute and there is great danger in doing so. In cases where a person is falsely convicted, they can be set free from prison and compensated for their time -- but they can never be given their life back.
A good rule of thumb for an individual (or a collection of individuals, such as a state) is to avoid mistakes that are not fixable -- and there is nothing less fixable than taking someone's life mistakenly.