The ammonia synthesis from nitrogen and water under ambient conditions is one of the most inviting but challenging reaction routes. Although nitrogen is abundant in the atmosphere and the ammonia synthesis reaction is exothermic on the thermodynamics, the conversion of N2 to ammonia is actually hard to proceed owing to the chemical inertness and stability of N2 molecules. In industry, ammonia synthesis is carried out by the Haber-Bosch process under harsh conditions (300-500 ℃, 20-30 MPa) associated with the requirement of substantial energy input and the enormous emission of greenhouse gases (e.g., CO2). Recently, a growing number of studies on photo(electro)catalytic and electrocatalytic nitrogen reduction reaction (NRR) in aqueous solution have attracted extensive attention, which holds great promise for nitrogen fixation under room temperature and atmospheric pressure. However, the very low efficiency and ambiguous mechanism still remain as the major hurdles for the development of photochemical and electrochemical NRR systems. Here we provide an overview of the latest progresses, remaining challenges and future prospects in photocatalytic and electrocatalytic nitrogen fixation. Moreover, this review offers a helpful guidance for the reasonable design of photocatalysts and electrocatalysts towards NRR by combining theory predictions and experiment results. We hope this review can stimulate more research interests in the relatively understudied but highly promising research field of NRR.