Nitrogen-rich porous carbon materials have been prepared by pyrolyzing buckwheat with a nano-CaCO3 template. The buckwheat-derived porous carbons exhibit high nitrogen content (3.14%) and interconnected mesoporous dominated porous structures with some macropores, which endows them high efficient electrochemical energy storage. When they tested as anode materials for sodium ion batteries, an initial reversible capacity of 258 mAh g−1 is obtained at 30 mA g−1, and a high capacity of 185 mAh g−1 can be maintained after 100 cycles. Moreover, this work suggests that the cost-effective biomass material of buckwheat is of great potential to be used as anodes for sodium ion batteries.