We report a simple yet efficient method to synthesize phosphorus- and nitrogen-co-doped glucose-derived microporous carbons with a simple inorganic salt (ammonium phosphate) as the single phosphorus and nitrogen source. The obtained products are typical microporous carbons with low surface area and narrow pore size distribution. The doping amount of oxygen, nitrogen, and phosphorus and the population of various functionalities were not only temperature-dependent, but also correlated with each other. The resultant samples exhibit a specific capacitance of 183.8 F g−1, a capacitance retention ratio of over 90%, and an operating voltage up to 1.4 V in an alkaline electrolyte of 6 M KOH. The promising electrochemical performances can be attributed to the synergetic effect of (1) pseudocapacitance that originated from rich and tunable surface group by co-doping of phosphorus and nitrogen; and (2) the electric double layer capacitance that came from the uniform porosities developed by in situ activation.