Solar water splitting using suitable photocatalysts is a potentially feasible technology for converting solar energy into chemical energy. g-C3N4-carbon dots (g-C3N4-C) composite, as an efficient photocatalyst for overall water splitting, has been explored. However, it remains unclear on the function of carbon dots. Here, we developed a novel synthesis route to prepare g-C3N4-C composite with uniform size and surface groups and state via one-step bottom-up approach. The band gap of g- C3N4-C can be tuned from 2.84 to 2.08 eV by changing the content of CDs due to CDs extends the conjugation length of g-C3N4 2D sheets. The photo-deposition and PL lifetime decay illustrate that the photo-generated electron transfer to the CDs site, and holes are left at g-C3N4 site. The electron transfer rate and efficiency of g- C3N4-C are much higher than those of g-C3N4 physically loaded with Pt or CDs nanoparticle. We also confirm that CDs work not only as a cocatalyst for H2 production, but also as a catalyst for H2O2 decomposition, which effectively prevent from H2O2 poison to g-C3N4. Our findings give a detailed understanding on the working mechanism of g-C3N4-Cx composites, which will beneficial to rational design highly efficient metal-free photocatalyst.