Histone deacetylase (HDAC)-targeted probes and prodrugs are crucial for cancer theranostics. We develop a self-immolative design that enables in vivo activatable near-infrared fluorescence (NIRF) and photoacoustic (PA) imaging and prodrug release in response to HDAC. This design comprises a phenyl ester linker with tunable reactivity, facilitating efficient release of caged fluorophores/drugs upon deacetylation. We engineer a new fluorophore using a spirocyclic xanthene scaffold with ring-open property, affording NIRF/PA detection with high contrast. We show that a nitro-substituted self-immolative linker allows sensitive NIRF/PA in vivo imaging of HDAC with minimal interferences. A highly efficient prodrug system is further developed for targeted therapy in HDAC-overexpressed triple negative breast tumors in mice. Our study provides a valuable paradigm for HDAC-targeted NIRF/PA imaging and prodrug release in vivo , highlighting its potential for bioimaging and drug development.