The optimal tradeoff between the certainty and severity of punishment is studied in a setting in which individuals are more sensitive to changes in certainty than severity and have state-dependent preferences-being convicted of a crime reduces utility at every wealth level. In this setting it is not optimal to set the probability of punishment at one even if it is costless to convict criminals, because reducing the certainty of punishment also reduces the probability that offenders' utility functions shift downward. The optimal level of certainty is therefore lower than that implied by prior studies based on state-independent preferences.