Because people spend a lot of time indoors every day, the presence of particulate matter with a diameter less than2.5 μm (PM2.5) and volatile organic molecular substances in indoor air adversely affect public health. These toxic compoundscan be removed from the air using high-efficiency air-filter materials with adsorption capacity. Metal-organic frameworks(MOFs) are among the most suitable materials for air purification as they are synthetic porous materials with excellentadsorption ability. In this study, the zeolitic imidazolate framework-8 (ZIF-8) is uniformly grown on the surface ofpolyacrylonitrile (PAN) nanofibers using an in situ growth method to prepare ZIF-8@PAN nanofiber composite membranes. The nanofiber composite membrane effectively removes PM2.5 and formaldehyde from the air. After loading the optimalamount of ZIF-8, the filtration efficiency of the nanofiber membrane for salt aerosol with a diameter of 0.3 μm increases from90.3 % to 96.9 %, and the removal rate of formaldehyde becomes 98 % within 20 min in the enclosed space of the laboratory. Moreover, after five repeated tests, the formaldehyde adsorption rate remains above 80 %. In addition, ZIF-8@PANnanofiber membranes are used to fabricate anti-haze window screens, which have great potential to improve indoor airquality and mitigate related health risks.