Because people spend a lot of time indoors every day, the presence of particulate matter with a diameter less than 2.5 µm (PM
2.5
) and volatile organic molecular substances in indoor air adversely affect public health. These toxic compounds can 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 excellent adsorption ability. In this study, the zeolitic imidazolate framework-8 (ZIF-8) is uniformly grown on the surface of polyacrylonitrile (PAN) nanofibers using an in situ growth method to prepare ZIF-8@PAN nanofiber composite membranes. The nanofiber composite membrane effectively removes PM
2.5
and formaldehyde from the air. After loading the optimal amount of ZIF-8, the filtration efficiency of the nanofiber membrane for salt aerosol with a diameter of 0.3 µm increases from 90.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@PAN nanofiber membranes are used to fabricate anti-haze window screens, which have great potential to improve indoor air quality and mitigate related health risks.