Codoping carbon with phosphorus and nitrogen can lead to bifunctional oxygen evolution and oxygen reduction catalyst with improved electrocatalytic activity. In this work, we demonstrate the non-pollution fabrication of porous carbon self-doped with N and P heteroatoms from spirulina, a kind of industrially cultivated microalgae which is rich in proteins and phosphates. The N, P self-doped biocarbon (NPBC) was obtained simply by pyrolyzing spirulina at 950°C. This single-step process eliminates additional chemicals including nitrogen source, phosphorus source, and pore-forming agents, thus allowing NPBC to become a true sense of potentially low-cost and sustainable oxygen electrocatalysts. NPBC exhibits large specific surface area (786.1m2/g), improved pore volume (0.73cm3/g), and doping levels of 2.15% for N and 0.97% for P (atom ratio). And it can deliver bifunctional activity in catalyzing both oxygen reduction and oxygen evolution reactions, with a small OER and ORR metrics (ΔE=0.82V). Using NPBC for the air electrodes, we develop primary and rechargeable zinc-air battery with a high discharge power density of 90.7mWcm−2 and a large energy density of 850Whkg−1 in ambient air conditions. Moreover, the rechargeable zinc-air battery shows good rechargeability.