Based on the principle of "fiber first", cellulose nanofibrils (CNF) and metal-organic framework (MOF) are utilized to prepare composite material. The CNF with high dispersibility was prepared via MgCl2/succinic acid hydrolysis, sodium chlorite oxidation and high-pressure homogenization, then it was chemically cross-linked with 1,2,3,4-butane tetracarboxylic acid (BTCA) and freeze-dried in a mold for 4 h to obtain the aerogel. The aerogel was fully esterified at 170 degrees C for 2 similar to 3 min to obtain aerogel B-CNF, then Zn2+ and 2-methylimidazole were synthesized in-situ on its surface, finally, ZIF-8@B-CNF composite aerogel was successfully prepared. After that, the composite aerogel was used for the adsorption of methylene blue (MB), and the effects of adsorption conditions including adsorption time, MB concentration, pH values of the solution were discussed. The ZIF-8@B-CNF composite aerogel was characterized by SEM (scanning electron microscope), XRD (X-ray diffraction), FT-IR (Fourier transform infrared spectroscopy), XPS (X-ray photoelectron spectroscopy), BET (Brunner-Emmet-Teller), etc., and the adsorption behavior and adsorption mechanism of MB were researched. The results showed that the ZIF-8@B-CNF composite aerogel had the advantages of low density and high surface area. When the loading capacity of ZIF-8 came up to 50%, the density of the ZIF-8@B-CNF was as low as less than 0.1 g.cm(-3), and its surface area were increased by 14.5 times compared with that of the CNF aerogel. The ZIF-8@B-CNF composite aerogel showed excellent adsorption capacity for the MB, its theoretical maximum adsorption capacity was as high as 352.59 mg.g(-1) based on the Langmuir adsorption model, demonstrating that the composite aerogel had excellent adsorption capacity. The adsorption process was in accordance with the quasi-second-order kinetic model, which belonged to the chemisorption. In addition, the adsorption behavior of MB on the composite aerogel mainly depended on the effects of electrostatic interaction, pi-pi stacking and hydrogen bonding.