In this study, the performance of superabsorbent polymers (SAPs) as self-healing agents in macrocracked ultra-high performance concrete (UHPC) was extensively evaluated, with a focus on compressive strength behavior in different aggressive environments. Three UHPC mixtures were designed: a control mixture, a UHPC with 0.3 % sodium polyacrylate (poly(AA)), and a UHPC with 0.3 % polyacrylate-co-acrylamide (poly(AA-co-AM)). Samples with macrocrack widths of 0.3 mm, 0.5 mm, and 1 mm, as well as uncracked samples, were prepared. The samples underwent immersion in deionized water, chloride saltwater, and compound saltwater. The performance of self-healing was evaluated by measuring crack closure rates, recovered compressive strength, and stereomicroscopic inspections. Further, scanning electron microscopy coupled with energy-dispersive X-ray spectroscopy (SEM/EDX) was performed to monitor mineral formation and the healing process. The results indicate that both poly(AA) and poly(AA-co-AM) SAPs significantly enhanced the self-healing capabilities of UHPC, with poly(AA) demonstrating superior performance. Self-healing was more pronounced in samples with cracks width of 0.3 mm, whereas samples with cracks widths of 0.5 mm and 1.0 mm exhibited incomplete and negligible healing, respectively. The healed samples recovered a substantial portion of their compressive strength, regardless of the crack width. However, the presence of chloride and/or sulfate ions was found to impede the self-healing process. As observed from the SEM/EDX results, in addition to CaCO3 and C-S-H gel, undesirable healing products like Friedel’s salt and ettringite were also formed in chloride and compound saltwater environments which significantly affected self-healing durability.