Ammonia is closely relevant to human production and life. Although the widely used conventional Haber−Bosch process has a relatively high ammonia yield, it has obvious disadvantages of high energy consumption, serious pollution, and harsh reaction conditions. Compared with the Haber−Bosch process, photo-and electrocatalytic N 2 fixation has been demonstrated to be energy-saving, environmentally friendly, and economical because the ammonia can be generated under mild conditions. During the photo/electrocatalytic ammonia-production processes, sunlight or electricity is used as the renewable energy input, the atmosphere is used as the nitrogen source, and water is used as the proton source. However, the ammonia yields of the photo-and electrocatalytic nitrogen fixation are commonly low, which is mainly resulted by the lack of active sites to adsorb N 2 molecules and active N�N triple bonds. On the basis of the discussion about the importance of active sites for ammonia synthesis by summarizing the reaction mechanism of photo-and electrocatalytic methods, we outline the common methods of producing abundant active sites of N 2 adsorption and activation on the surface of catalysts, including vacancy introduction, heteroatom doping, cocatalyst support, and frustrated Lewis pairs construction. We also summarize the detection methods of ammonia, as well as other problems existing during the photo-and electrocatalytic nitrogen-fixation processes.