Li metal has been regarded as one of the most promising anode candidates for high-energy rechargeable lithium batteries. Nevertheless, the practical applications of the Li anode have been hampered because of its low Coulombic efficiency and safety hazards. Here, acid-treated g-C3N4 with O- and N-containing groups are coated on Li foil through a facile physical pressing method. The O- and N-containing groups cooperate to rearrange the concentration of Li ions and enhance the Li ion transfer. Hence, the cycle and rate performances of acid-treated g-C3N4-coated Li electrodes are greatly improved in symmetric cells, which show cycling stability over 400 h at 1 mA cm-2 in ester-based electrolytes and over 2100 h in ether-based electrolytes. As for the Li//LiFePO4 full cells, there is a high capacity retention of 80% over 400 cycles at 1 C. The full cells of Li//S in ether-based electrolytes also exhibit a capacity of 520 mA h g-1 after 400 cycles at 1 C.