[email protected]–8 nanocomposite was prepared by in situ encapsulation of horseradish peroxidase (HRP) in the frame of zeolitic imidazolate framework–8 (ZIF–8) with a simple one-pot method. The [email protected]–8 nanocomposite displays outstanding thermal stability and efficiently catalyzes the chemiluminescence (CL) reaction of luminol with hydrogen peroxide (H2O2) under near-neutral pH condition (pH 7–8). This CL system has a good response to H2O2 with a linear range of 0.1–100.0 μmol L−1. The limit of detection (LOD) is 0.06 μmol L−1 H2O2. By marriage with cholesterol oxidase, cholesterol is determined with a linear range from 0.1 to 100.0 μmol L−1 and a LOD of 0.04 μmol L−1. The relative standard deviations (RSD) are 1.7% and 2.5%, respectively, in 11 repeated measurements of 50.0 μmol L−1 solutions of H2O2 and cholesterol, indicating excellent precision of the method. The method shows good selectivity and has been applied to the determination of total cholesterol in real serum samples. No significant difference has been observed between the results obtained by this method and the cholesterol oxidase–peroxidase coupling method. Graphical abstractSchematic presentation of in situ one-pot synthesis of horseradish [email protected] imidazolate framework–8 ([email protected]–8) nanocomposite and chemiluminescence determination of cholesterol with [email protected]–8 catalyzing luminol–H2O2 system.