The invention relates to a method for preparing nitrogen doping hollow carbon nanocages, which comprises the following steps that: (1) basic magnesium carbonate or magnesium carbonate is taken to be added into a reaction tube and is uniformly dispersed, then the reaction tube is placed in a tube furnace, air in the tube furnace is extracted, inert gases are filled into the tube furnace, under the condition of 10-500sccm of inert gases, the temperature of the tube furnace is increased to 650-1,100 DEG C, then the inert gas flow is guided into steam which contains carbon (C) and nitrogen (N), and after reacting for 5-240min, the temperature of the tube furnace is reduced to a room temperature; and (2) powder in the reaction tube is collected, put into hydrochloric acid or sulfuric acid solution to be soaked for 5-720min, filtered, cleaned by deionized water and dried, so a nitrogen doping hollow carbon nanocage is obtained. The nitrogen doping hollow carbon nanocage which is produced by the method has the advantages of high specific surface area, large pore volume, high mesoporous ratio, good graphitization degree and the like, and is a metal-free oxygen reduction reaction catalyst with excellent performance.