Here, we present a protocol to synthesize nitrogen/oxygen dual-doped mesoporous carbon from biomass by chemical activation in different pyrolysis modes followed by modification. We demonstrate that the microwave pyrolysis benefits the subsequent modification process to simultaneously introduce more nitrogen and oxygen functional groups on the carbon.