Autophagy not only degrades components of host cells but can also target intracellular bacteria and thus contribute to host defences. Here, Huang and Brumell discuss the canonical and selective pathways of antibacterial autophagy, as well as the ways in which bacteria can escape from them and sometimes even use them to promote infection.