β-Galactosidase (β-gal), overexpressed in primary ovarian tumors, serves as an important biomarker for ovarian cancer. Accurate and sensitive detection of β-gal is crucial for cancer diagnosis and therapy. Activatable multimodal probes that show enhancement of multiplex imaging signals upon interaction with their specific molecular target have become powerful tools for rapid and precise imaging of biological processes. Nevertheless, the rational design of such probes remains challenging. Herein, a novel β-gal-activated probe, named Gal-Cy-Gd-F, was designed and synthesized for trimodal imaging of its activity in vivo. Upon activation by β-gal, the probe underwent a unique quinone methide-mediated self-immobilization mechanism that covalently anchored onto the target enzyme or neighboring proteins, thereby effectively prolonging its retention time. Consequently, the longitudinal relaxivity increased from 8.67 ± 0.5 mM