Infections are estimated to contribute to 20% of all human tumours. Viruses are known to induce cell transformation, but evidence has also linked bacteria, such as Helicobacter pylori and Salmonella enterica subsp. enterica serovar Typhi, to different cancer types. In addition, Chlamydia trachomatis, Fusobacterium nucleatum and Bacteroides fragilis are associated with the development of cancer, although a causal relationship has not yet been established. Bacterial effectors such as colibactin and the virulence factor cytotoxin-associated gene A (CagA) can promote cancer directly by influencing host cell signalling cascades, such as the WNT and ataxia-telangiectasia mutated (ATM) pathways, or indirectly by inducing tissue damage and inflammatory responses. In this Review, we discuss how bacterial pathogens interact with host cells to contribute to the development of cancer.