Afterglow luminescent probes with high signal-to-background ratio show promise for in vivo imaging; however, such probes that can be selectively delivered into target sites and switch on afterglow luminescence remain limited. We optimize an organic electrochromic material and integrate it into near-infrared (NIR) photosensitizer (silicon 2,3-naphthalocyanine bis(trihexylsilyloxide) and (poly[2-methoxy-5-(2-ethylhexyloxy)-1,4-phenylenevinylene]) containing nanoparticles, developing an H 2 S-activatable NIR afterglow probe (F1 2+-ANP). F1 2+-ANP displays a fast reaction rate (1563 ± 141 M −1 s −1) and large afterglow turn-on ratio (~122-fold) toward H 2 S, enabling high-sensitivity and-specificity measurement of H 2 S concentration in bloods from healthy persons, hepatic or colorectal cancer patients. We further construct a hepatic-tumor-targeting and H 2 Sactivatable afterglow probe (F1 2+-ANP-Gal) for noninvasive, real-time imaging of tiny subcutaneous HepG2 tumors (<3 mm in diameter) and orthotopic liver tumors in mice. Strikingly, F1 2+-ANP-Gal accurately delineates tumor margins in excised hepatic cancer specimens, which may facilitate intraoperative guidance of hepatic cancer surgery.