Peer punishment is widely considered a key mechanism supporting cooperation in human groups. Although much research shows that human behaviour is shaped by the prevailing social norms, little is known about how punishment decisions are impacted by the social context. Here we show that people?s willingness to punish free riders strongly depends on descriptive social norms of cooperation and punishment. Participants in a large-scale experiment (N=999) could punish their partner conditional on the level of cooperation or the level of punishment displayed by others who previously interacted in the same setting. We find that many people punish free riding more severely when cooperation is more common (‘norm enforcement’), and when free riding is more severely punished by others (‘conformist punishment’). With a dynamic model we demonstrate that these conditional punishment strategies can substantially promote cooperation. In particular, conformist punishment helps cooperation to gain a foothold in a population, and norm enforcement helps to maintain cooperation at high levels. Our results provide solid empirical evidence of conditional punishment strategies and illustrate their possible implications for the dynamics of human cooperation.