Reducing criminal acts in society is a crucial duty of governments. Establishing punishment structures to attain this goal involves high costs. Typically, both theorists and practitioners resort to the adjustment of severity and/or certainty of punishment as effective deterrents of criminal behavior. One more cost effective, but scientifically understudied mechanism for effective deterrence is the swiftness of punishment. We carry out the first controlled economic experiment to study the effectiveness of swiftness of punishment along the following two dimensions: the timing of punishment and the timing of the resolution of uncertainty regarding punishment. Our results indicate an inverted u-shaped relation between the delay of punishment, the delay of uncertainty resolution regarding the detection of deviant behavior, and any resulting deterrence. In fact, institutions that either reveal detection and impose punishment immediately or maintain uncertainty about the state of detection and impose punishment sufficiently late deter individuals at equal rates. We conclude that the same institutional settings that are capable of reducing recidivism are also the ones deterring deviant behavior in the first place. Our results yield strong policy implications for designing effective institutions in mitigating misconduct and reducing recidivism.