CRISPR loci and Cas proteins provide adaptive immunity in prokaryotes against invading bacteriophages and plasmids. In response, bacteriophages have evolved a broad spectrum of anti-CRISPR proteins (anti-CRISPRs) to counteract and overcome this immunity pathway. Numerous anti-CRISPRs have been identified to date, which suppress single-subunit Cas effectors (in CRISPR class 2, type II, V and VI systems) and multisubunit Cascade effectors (in CRISPR class 1, type I and III systems). Crystallography and cryo-electron microscopy structural studies of anti-CRISPRs bound to effector complexes, complemented by functional experiments in vitro and in vivo, have identified four major CRISPR-Cas suppression mechanisms: inhibition of CRISPR-Cas complex assembly, blocking of target binding, prevention of target cleavage, and degradation of cyclic oligonucleotide signalling molecules. In this Review, we discuss novel mechanistic insights into anti-CRISPR function that have emerged from X-ray crystallography and cryo-electron microscopy studies, and how these structures in combination with function studies provide valuable tools for the ever-growing CRISPR-Cas biotechnology toolbox, to be used for precise and robust genome editing and other applications.