The intestine represents the largest compartment of the immune system. It is continually exposed to antigens and immunomodulatory agents from the diet and the commensal microbiota, and it is the port of entry for many clinically important pathogens. Intestinal immune processes are also increasingly implicated in controlling disease development elsewhere in the body. In this Review, we detail the anatomical and physiological distinctions that are observed in the small and large intestines, and we suggest how these may account for the diversity in the immune apparatus that is seen throughout the intestine. We describe how the distribution of innate, adaptive and innate-like immune cells varies in different segments of the intestine and discuss the environmental factors that may influence this. Finally, we consider the implications of regional immune specialization for inflammatory disease in the intestine.