Macrophages play a crucial role in immune activation and provide great value in the prognosis of cancer treatments. Current strategies for prognostic evaluation of macrophages mainly target the specific biomarkers to reveal the number and distribution of macrophages in the tumors, whereas the phenotypic change of M1 and M2 macrophages in situ is less understood. Here, we designed an ultrasmall superparamagnetic iron oxide nanoparticle-based molecular imaging nanoprobe to quantify the repolarization of M2 to M1 macrophages by magnetic resonance imaging (MRI) using the redox-active nitric oxide (NO) as a vivid chemical target. The nanoprobe equipped with O-phenylenediamine groups could react with the intracellular NO molecules during the repolarization of M2 macrophages to the M1 phenotype, leading to electrical attraction and colloidal aggregation of the nanoprobes. Consequently, the prominent changes of the T1 and T2 relaxation in MRI allow for the quantification of the macrophage polarization. In a 4T1 breast cancer model, the MRI nanoprobe was able to reveal macrophage polarization and predict treatment efficiency in both immunotherapy and radiotherapy paradigms. This study presents a noninvasive approach to monitor the phenotypic changes of M2 to M1 macrophages in the tumors, providing insight into the prognostic evaluation of cancer treatments regarding macrophage-mediated immune responses.