A highly dispersed Pt/g-C3N4 nanocomposite photocatalyst was successfully prepared by depositing platinum nanoparticles (NPs) onto the surface of g-C3N4 with uniform size.