Herein, a two-photon (TP) ratiometric fluorescent probe (NpFA) was developed for detecting formaldehyde (FA) in real food samples, living onion tissues and zebrafish by fluorescence resonance energy transfer (FRET) strategy. Specifically, a TP fluorophore as the donor and a FA turn-on naphthalimide fluorophore as the acceptor were connected by a non-conjugated linker to construct the TP-FRET-based NpFA, which exhibited a target-modulated ratiometric fluorescence response to FA rapidly with high selectivity and sensitivity during 65s, and a large ratio ~5-fold enhancement at I550/I410 after addition of FA, displaying ~60-fold enhancement at 550nm and a quite low DOC of 5.8±0.2nM. Moreover, NpFA has a good imaging resolution and depth of deep tissue penetration. Therefore, based on the above results, NpFA has the capability to be a useful tool for investigating FA in real samples application, and we also hope NpFA will further study of the physiological and pathological function of FA.