Exploring a new type of nonlinear optical switch molecule with excess electron character is extremely important for promoting the application of excess electron compounds in the nonlinear optical (NLO) field. Here, we report external electric field (EEF) induced second-order NLO switch molecules of inorganic alkaline-earth alkalides, M(NH3)6Na2 (M = Mg or Ca). The centrosymmetric structure of M(NH3)6Na2 is destroyed in the presence of an EEF, and then a long-range charge transfer process occurs. It has been found that excess electrons are gradually transferred from one Na atom to the other Na atom through the inorganic metal cluster M(NH3)6. Finally, the excess electrons are completely located on one of the two Na atoms. In particular, the electronic contribution of the static first hyperpolarizability (βe0) for M(NH3)6Na2 exhibits a large significant difference when the EEF is switched on. The βe0 value of M(NH3)6Na2 is 0 when EEF = 0, while the peak βe0 values are 5.95 × 106 (a.u.) for Mg(NH3)6Na2 (EEF = 58 × 10-4 (a.u.)) and 1.83 × 107 (a.u.) for Ca(NH3)6Na2 (EEF = 53 × 10-4 (a.u.)). This work demonstrates that the compounds M(NH3)6Na2 can serve as potential candidates for NLO switches.