Democracy assistance, including the promotion of electoral security, is often a central component of contemporary peacekeeping operations. Preventing violence during post-conflict elections is critical for the war-to-democracy transition. Yet little is known about the role of peacekeepers in this effort. To fill this gap, this study provides the first comprehensive sub-national study of peacekeeping effectiveness in reducing the risk of electoral violence. It combines geo-referenced data on peacekeeping deployment across all multidimensional peacekeeping missions in Africa over the past two decades with fine-grained data on electoral violence. The analysis finds a negative association between peacekeeping presence and the risk of electoral violence. The relationship is of a similar magnitude in the pre- and post-election periods. However, the association is more strongly negative for violence perpetrated by non-state actors compared to violence perpetrated by government-affiliated actors. Analyses using two-way fixed-effects models and matching mitigate potential selection biases.