Hydrogen peroxide (H2O2) and glucose play a key role in many cellular signaling pathways. The efficient and accurate in situ detection of H2O2 released from living cells has attracted extensive research interests. Herein, a new porphyrin-based porous covalent organic framework (TAP-COF) was fabricated via one-step condensation of 1,6,7,12-tetrachloroperylene tetracarboxylic acid dianhydride and 5,10,15,20-tetrakis (4-aminophenyl)porphyrin iron(III). The obtained TAP-COF has high surface areas, abundant surface catalytic active sites, and highly effective electron transport due to its precisely controllable donor-acceptor arrangement and 3D porous structure. Then, the new TAP-COF exhibited excellent peroxidase-like catalytic activity, which could effectively catalyze oxidation of the substrate 3,3',5,5'-tetramethylbenzidine by H2O2 to produce a typical blue-colored reaction. On this basis, simple, rapid and selective colorimetric methods for in situ H2O2 detection were developed with the detection limit of 2.6 nM in the wide range of 0.01 to 200 μM. The colorimetric approach also could be used for in situ detection of H2O2 released from living MCF-7 cells. This portable sensor based on a COF nanozyme not only opens a new path for point-of-care testing, but also has potential applications in the field of cell biology and clinical diagnosis.