In this work, we report the development of the first H2O2-triggered ERβ-targeted near-infrared fluorescence (NIR) probe and its application in imaging of prostate cancer both in vitro and in vivo. Here, ESR2 is linked to prostate cancer.