In rechargeable lithium-oxygen (Li-O2) batteries, the porosity of porous carbon materials plays a crucial role in the electrochemical performance serving as oxygen diffusion path and Li ion transfer passage. However, the influence of optimization of porous carbon as an air electrode on cell electrochemical performance remains unclear. To understand the role of carbon porosity in Li-O2 batteries, carbon materials featuring controlled pore sizes and porosity, including C-800 (nearly 96% microporous) and AC-950 (55:45 micro/meso porosity), are designed and synthesized by carbonization using a triazine-based covalent organic polymer (TCOP). We find that the microporous C-800 cathode allows 120 cycles with a limited capacity of 1000 mAh g−1, about 2 and 10 times higher than that of mixed-porosity AC-950 and mesoporous CMK-3, respectively. Meanwhile, the specific discharge capacity of the C-800 electrode at 200 mA g−1 is 6003 mAh g−1, which is lower than that of the 8433 and 9960 mAh g−1 when using AC-950 and CMK-3, respectively. This difference in the electrochemical performance of the porous carbon cathode with different porosity causes to the generation and decomposition of Li2O2 during the charge and discharge cycle, which affects oxygen diffusion and Li ion transfer.