Decidual macrophages (dMϕ) contribute to maternal-fetal tolerance. However, the mechanism of dMϕ differentiation during pregnancy is still largely unknown. Here, we report that receptor activator for nuclear factor-κ B ligand (RANKL), secreted by human embryonic trophoblasts and maternal decidual stromal cells (DSCs), polarizes dMϕ toward a M2 phenotype. This polarization is mediated through activation of Akt/signal transducer and activator of transcription 6 (STAT6) signaling, which is associated with the upregulation of histone H3 lysine-27 demethylase Jmjd3 and IRF4 in dMϕ. Such differentiated dMϕ can induce a Th2 bias that promotes maternal-fetal tolerance. Impaired expression of RANKL leads to dysfunction of dMϕ in vivo and increased rates of fetal loss in mice. Transfer of RANK+Mϕ reverses mouse fetal loss induced by Mϕ depletion. Compared with normal pregnancy, there are abnormally low levels of RANKL/RANK in villi and decidua from miscarriage patients. These results suggest that RANKL is a pivotal regulator of maternal-fetal tolerance by licensing dMϕ to ensure a successful pregnancy outcome. This observation provides a scientific basis on which a potential therapeutic strategy can be targeted to prevent pregnancy loss.