Carbon dioxide (CO2) is an important sensory cue for many animals, including both parasitic and free-living nematodes. Many nematodes show context-dependent, experience-dependent and/or life-stage-dependent behavioural responses to CO2, suggesting that CO2 plays crucial roles throughout the nematode life cycle in multiple ethological contexts. Nematodes also show a wide range of physiological responses to CO2. Here, we review the diverse responses of parasitic and free-living nematodes to CO2. We also discuss the molecular, cellular and neural circuit mechanisms that mediate CO2 detection in nematodes, and that drive context-dependent and experience-dependent responses of nematodes to CO2.