Nanoscale magnesium clusters are important potential hydrogen storage materials, and density functional theory (DFT) is mainly used for their theoretical investigation. The results of the coupled-cluster theory at the singles and doubles level with a perturbative treatment of triples [CCSD(T)] were employed previously to choose proper exchange–correlation (XC) functionals in DFT calculations for magnesium clusters, but it is too expensive to be applied to Mgn with n > 7. The diffusion Monte Carlo (DMC) method is employed in this work to study magnesium clusters up to nanosize. The error of atomization energies with DMC using single-determinant-Jastrow (SDJ) trial wavefunctions has been shown to be somewhat larger than that of CCSD(T) for many molecules. However, cohesive energies with DMC using SDJ for Mgn with n ≤ 7 are in excellent agreement with those of CCSD(T) using the aug-cc-pVQZ basis set, with a difference of less than 1 kcal/mol. DMC results are employed to investigate the performance of different XC functionals on magnesium clusters. Our results indicate that the PBE0 functional is the best XC functional for determining the lowest-energy isomer when compared with DMC results, while the RPBE functional is the best XC functional for calculating cohesive energies per atom of these magnesium clusters with a mean absolute error of 0.5 kcal/mol. These XC functionals are expected to provide reasonable results for even larger magnesium clusters.