The electron configuration of an atom can be determined by identifying first the right order of the electron shells. The atomic number of Magnesium is 12 so we expect the electrons also sum up to 12. The condensed electron configuration is Ne 3s2. The complete configuration is 1s2 2s2 2p6 3s2.