A direct, simple and low-cost approach to synthesising carbon aerogel-magnesium (CA-Mg) composites has been demonstrated in this research. It is conducted by carbonising sodium carboxymethyl cellulose (CMC) aerogels via a sol-gel and freeze-drying process. Mg is used as an enhancer for CA in the preparation step and as a selective candidate for the hydrogen storage device. Note that the structure and morphology of CA-Mg composites are characterised using field emission scanning electron microscopy (FESEM), fourier transforms infrared spectroscopy (FTIR) and X-ray diffraction (XRD) techniques. The ability of CA-Mg composites to act as a hydrogen storage device is analysed by utilising Brunauer-Emmett-Teller (BET) and temperature-programmed desorption analysis. The CA-Mg composites comprise porous structures with a high specific surface area of 101.4407 m2/g, and 0.002 mol of Mg2+ is the optimum concentration for synthesising CA-Mg composites. As a potential candidate for a hydrogen storage device, the CA-Mg composites show an initial dehydrogenation temperature of 377.22°C, where they desorbed the maximum amount of hydrogen gas. This study emphasises the potential for using CA as a hydrogen storage device, which fulfils the seventh goal of the Sustainable Development Goals (SDGs), affordable and clean energy, as well as Department of Energy (DOE)’s goal of using carbon-based materials.