Hydrogen polysulfide (H2Sn) has attracted increasing attention due to the fact that it is actually the key signaling molecule rather than hydrogen sulfide (H2S). Therefore, developing a sensitive and accurate assay to investigate the biosynthetic pathways of H2Sn is of physiological and pathological significance. In this work, based on the commonly used two-photon fluorophore, 1,8-naphthalimide, a new probe, NRT-HP, has been designed and synthesized that displayed both one- and two-photon ratiometric fluorescence changes toward H2Sn via H2Sn-mediated benzodithiolone formation. NRT-HP exhibits excellent pH stability, high selectivity and low detection limit (0.1 μM) in aqueous media. Furthermore, two-photon fluorescence microscopy experiments have demonstrated that NRT-HP could be used for the H2Sn detection in live cells as well as tissue slices.