Graphitic carbon nitride (g-C3N4) fabricated from different precursors exhibits unique microstructures and photocatalytic performance under visible light. Herein, we synthesized five different microstructures of g-C3N4 by the thermal poly condensation method using guanidine hydrochloride, melamine, urea, dicyandiamide and thiourea as the precursors. The results indicated that g-C3N4 prepared from urea precursor (UCN) has a nanostructure, porous layered structure, large specific surface area, and high separation efficiency of photo generated hole-electron pairs, which showed the best photocatalytic activity among all of the as-prepared samples. As for the lowest cost among the above five precursors, urea is an ideal candidate material for preparing g-C3N4 photocatalyst for a huge potential of wide industrial applications. In addition, Pt or Ni were used as the co-catalyst and loaded onto the g-C3N4 surface for photocatalytic hydrogen production. In comparison with noble metal Pt co-catalyst, Ni co-catalyst is inexpensive and has a significant effect o enhancing the photocatalytic activity under visible light. Therefore, Ni exhibits a considerable prospect to replace noble metal co-catalysts in the photocatalytic reactions.