The electrocatalytic coreduction of CO2 and nitrate is a green method for urea synthesis, mitigating CO2 emission and nitrate contamination. However, its slow kinetics and high energy barrier result in a poor urea production performance. Herein, we reported N-doped porous hollow carbon spheres (N-PHCS) for promoting CO2 and nitrate conversion to urea via nanoconfinement and N-doping from both reaction kinetics and thermodynamics. A high urea yield of 12.0 mmol h-1 gcat-1 with Faradaic efficiency of 19.1% was achieved on N-PHCS at -1.0 V (vs Ag/AgCl), which was comparable to or even higher than those of metal-based electrocatalysts reported. The experimental and theoretical calculation results revealed that carbon spheres with an appropriate interior void and pore size were favorable for confining reactants and intermediates to accelerate urea production, while N-doping can reduce the energy barrier for urea synthesis. By regulating the microstructure and N doping of N-PHCS, it showed a superior performance for urea electrosynthesis. The energy favorable pathway for urea synthesis was through the C-N coupling reaction of *NO and *CO, and pyridinic N can reduce the reaction energy barrier.