• The as-synthesized rN-pC exhibited H2 uptake of ~0.9 wt% at 77 K and ultralow pressure of ~0.1 bar, with an isosteric adsorption enthalpy (Qst) of ~14 kJ mol-1 H2 at zero coverage.
• The 60MgH2@rN-pC started to decompose at 175 °C and released H2 of 3.38 wt% at 300 °C within 30 min, which showed outstanding desorption kinetics of MgH2 among Mg-carbon material nanocomposites.
• The drawback of nanoconfinement scaffolds that cannot store hydrogen was firstly overcome.
• The nanoconfined MgH2 formation enthalpy is reduced to ~68 kJ mol−1 H2 from ~75 kJ mol−1 H2 for pure MgH2, and the composite can be compressed to pellets with volumetric H2 density reaching 33.4 g L−1, surpassing 350 bar compressed H2.