Persistence and perseverance, even in the face of great adversity, are admirable qualities. However, knowing when to stop pursuing something is as important as exerting effort toward attaining a goal. Howdo people decide when to persist and when to quit? Here, we design a novel task to study this question, in which people were given a finite number of opportunities to pursue stochastic rewards by selecting among a set of options that provide a reward each trial. At any time, if people were not satisfied with the option they had selected they could choose to abandon it and instead try a new option. However, if they did so they could never return to the previous option. Mathematical analysis of this task shows that the optimal strategy explores a relatively small number of options before settling on a sufficiently good option. Further, we find that the optimal strategy is to abandon an option if the total number of remaining trials exceeds a threshold specified by the observed option’s performance. A large-scale, pre-registered experiment (N = 3,632) reveals that people largely behave in accordance with the optimal strategy. People also make decisions to persist with an option based on its performance and they typically explore relatively few options before settling on a sufficiently good one. However, compared to the optimal strategy, people are less sensitive to the number of remaining trials and are more likely to persist with sub-optimal options. Together, this work provides a new approach to studying how we decide when to quit and deepens our understanding of human persistence.