Electrochemical nitrate reduction reaction (NO3RR) is a promising approach to achieve remediation of nitrate-polluted wastewater and sustainable production of ammonia. However, it is still restricted by the low activity, selectivity and Faraday efficiency for ammonia synthesis. Herein, we propose an effective strategy to modulate the electrolyte microenvironment in electrical double layer (EDL) by mediating alkali metal cations in the electrolyte to enhance the NO3RR performance. Taking bulk Cu as a model catalyst, the experimental study reveals that the NO3 --to-NH3 performance in different electrolytes follows the trend Li+<Cs+<Na+<K+. Theoretical studies illustrate that the proton transport rate in NO3RR and the activity of the rate-determining step (NO3 - to NO2 -) increase in the order Li+<Cs+<Na+<K+. The cation effects are also general for two typical nanostructured catalysts including copper/cuprous oxide and nickel phosphides, achieving near-100 % Faradaic efficiency and over 99 % conversion of NO3 - to NH3. Furthermore, we demonstrate that NO3 - can be converted to high-purity NH4Cl by copper/cuprous oxide catalyst in K+-containing electrolyte.