Despite a general agreement that piracy poses a significant threat to maritime shipping, empirical evidence regarding its economic consequences remains scarce. This paper combines firm-level Chinese customs data and ship position data with information on pirate attacks to investigate how exporting firms and cargo ships respond to maritime piracy. It finds that overall exports along affected shipping routes fall following an increase in pirate activity. In addition, piracy induces firms to switch from ocean to air shipping, while remaining ocean shipments become larger. At the ship-level, the paper provides evidence for re-routing, as container ships avoid regions prone to pirate attacks.