Nanostructured biological materials inspire the creation of materials with tunable mechanical properties. Strong cellulose nanofibrils derived from bacteria or wood can form ductile or tough networks that are suitable as functional materials. Here, we show that freeze-dried bacterial cellulose nanofibril aerogels can be used as templates for making lightweight porous magnetic aerogels, which can be compacted into a stiff magnetic nanopaper. The 20-70-nm-thick cellulose nanofibrils act as templates for the non-agglomerated growth of ferromagnetic cobalt ferrite nanoparticles (diameter, 40-120 nm). Unlike solvent-swollen gels and ferrogels, our magnetic aerogel is dry, lightweight, porous (98%), flexible, and can be actuated by a small household magnet. Moreover, it can absorb water and release it upon compression. Owing to their flexibility, high porosity and surface area, these aerogels are expected to be useful in microfluidics devices and as electronic actuators.