The mammary gland is a unique organ that develops predominantly after birth and undergoes dramatic remodelling in reproductive phases. Macrophages have been implicated in mammary gland function and remodelling but their diversity has not been fully addressed. 3D microscopy of optically cleared tissue is a powerful tool for revealing cellular interaction in situ. Using this technique, we have identified a rare and unique population of mammary gland-resident ductal macrophages (DMs). These are dendritic-shaped and form a contiguous network between the luminal and basal layers of the entire mammary gland throughout post-natal development. To directly observe DM behaviour, we developed an intravital imaging approach that allowed high-resolution, 3D imaging of virgin mammary ducts in vivo, revealing the nature of DM–epithelium interactions. Functionally, DMs proliferate in pregnancy to maintain complete coverage of the epithelium in lactation, where they are poised to phagocytose milk-producing cells post-lactation and facilitate remodelling. In the context of breast cancer, DMs strongly resemble mammary tumour-associated macrophages and increase throughout tumorigenesis to form a network that pervades the tumour epithelium. Thus, the mammary epithelium programs specialised resident macrophages in both physiological and tumorigenic contexts.