Macrophages are strategically located throughout the body tissues, where they ingest and process foreign materials, dead cells and debris and recruit additional macrophages in response to inflammatory signals. They are highly heterogeneous cells that can rapidly change their function in response to local microenvironmental signals. In this Review, we discuss the four stages of orderly inflammation mediated by macrophages: recruitment to tissues; differentiation and activation in situ; conversion to suppressive cells; and restoration of tissue homeostasis. We also discuss the protective and pathogenic functions of the various macrophage subsets in antimicrobial defence, antitumour immune responses, metabolism and obesity, allergy and asthma, tumorigenesis, autoimmunity, atherosclerosis, fibrosis and wound healing. Finally, we briefly discuss the characterization of macrophage heterogeneity in humans.