Background Flavonoids are widely used in the market because of their antibacterial, antiviral, and antioxidant activities. But the production speed of flavonoids is limited by the growth of plants. CBL9 (Chaetomium cruentum) is a flavonoid-producing endophytic fungi from Conyza blinii H. Lév, which has potential to produce flavonoids. Methods In this study, we isolated total flavonoids from endophytic fungus CBL9 of Conyza blinii H. Lév using macroporous resin D101. The process was optimized by response surface and the best extraction process was obtained. The antioxidant activities of total flavonoids were analyzed in vitro. Results It was found that the best parameters were 25 °C pH 2.80, 1.85 h, and the adsorption ratio reached (64.14 ± 0.04)%. A total of 60% ethanol was the best elution solvent. The elution ratio of total flavonoid reached to (81.54 ± 0.03)%, and the purity was 7.13%, which was increased by 14.55 times compared with the original fermentation broth. Moreover its purity could rise to 13.69% after precipitated by ethanol, which is very close to 14.10% prepared by ethyl acetate extraction. In the antioxidant research, the clearance ratio of L9F-M on DPPH, ABTS, *OH, *O.sup.2- , (96.44 ± 0.04)% and (75.33 ± 0.03)%, (73.79 ± 0.02)%, (31.14 ± 0.01)% at maximum mass concentration, was higher than L9F. Conclusion The result indicated using macroporous resin in the extraction of total flavonoid from endophytic fungus is better than organic solvents with higher extraction ratio, safety and lower cost. In vitro testing indicated that the flavonoid extracted by macroporous resin have good antioxidant activity, providing more evidence for the production of flavonoid by biological fermentation method.