Epilepsy is a chronic neurodegenerative disease that has seriously threatened human health. Accumulating evidence reveals that the pathological progression of epilepsy is closely related to peroxynitrite (ONOO-). Unfortunately, understanding the physiological roles of ONOO- in epilepsy is still challenging due to the lack of powerful imaging probes for the determination of the level of fluctuations of ONOO- in the epileptic brain. Herein, a near-infrared (NIR) two-photon (TP) fluorescent probe [dicyanomethylene-4H-pyran (DCM)-ONOO] is presented to trace ONOO- in living cells and in kainate (KA)-induced rat epilepsy models with satisfactory sensitivity and selectivity. The probe is composed of a NIR TP DCM fluorophore and a recognition moiety diphenylphosphinamide. The phosphoramide bond of the probe is interrupted after reacting with ONOO- for 10 min, and then, the released amino groups emit strong fluorescence due to the restoration of the intramolecular charge transfer process. The probe can effectively detect the changes of endogenous ONOO- with excellent temporal and spatial resolution in living cells and in rat epileptic brain. The imaging results demonstrate that the increasing level of ONOO- is closely associated with epilepsy and severe neuronal damage in the brain under KA stimulation. In addition, the low-dose resveratrol can effectively inhibit ONOO- overexpression and further relieve neuronal damage. With the assistance of TP fluorescence imaging in the epileptic brain tissue, we hypothesize that the abnormal levels of ONOO- may serve as a potential indicator for the diagnosis of epilepsy. The TP fluorescence imaging based on DCM-ONOO provides a great potential approach for understanding the epilepsy pathology and diagnosis.