The potential of various nanocages in metal-ion batteries are examined to propose novel materials with higher e ciency. The gap energy (E HLG ), cohesive energy (E cohesive ) and adsorption energy (E adsorption ) of C 38 , F-C 38 , Cl-C 38 , Si 38 , F-Si 38 and Cl-Si 38 nanocages are calculated by theoretical methods. The interaction energy (E interaction ), cell voltage (V cell ) and theoretical capacity (C theory ) of C 38 , F-C 38 , Cl-C 38 , Si 38 , F-Si 38 , Cl-Si 38 nanocages in Li-ion batteries and Mg-ion batteries are calculated in gas phase and water. Results shown that the attaching of F and Cl can increase the E cohesive and stability of carbon and silicon nanocages. The silicon nanocages in Mg-ion battery and Li-ion battery have higher V cell and C theory than corresponding carbon nanocages. The Mgion batteries have higher V cell and C theory values than Li-ion batteries. Results shown that F and Cl attached to silicon nanocages (F-Si 38 and Cl-Si 38 ) have the highest V cell and C theory values in gas phase and water.