pH-responsive biocompatible Fe(III)-gallic acid nanoparticles with strong near-infrared absorbance are very stable in mild acidic conditions, but easily decomposed in neutral conditions, which enables the nanoparticles to be stable in a tumor and easily metabolized in other organs, thus providing a safe nanoplatform for in vivo photoacoustic imaging/photothermal therapy theranostic applications.