Neutrophil elastase (NE) plays a key role in chronic inflammation and acute responses to infection and injury. Effective diseases interventions thus call for precise identification of NE to aid clinical application of such diseases. However, the detection process suffers from this interference of structural changes of NE. Herein, we introduce a molecular probe with high biocompatibility to overcome the interference, which was achieved by combining theoretical calculation and experimental that permits highly specific and sensitive detection of NE in cells and in vivo. The upregulated NE accumulation was specifically measured in inflammation by ratiometric photoacoustic and near-infrared fluorescence imaging, and providing a new method for developing more specific fluorogenic probes for other enzymes.