Using g‐C3N4 as semiconductor carrier, CoB particles were loaded onto the surface of g‐C3N4 to prepare CoB/g‐C3N4 photocatalyst, which exhibited improved the photocatalytic water splitting to hydrogen production performance. By comparison, it was found that bare g‐C3N4 did not produce H2, all as‐prepared CoB/g‐C3N4 photocatalysts could produce H2, and the loaded mass of CoB cocatalyst was 15 %, CoB/g‐C3N4 photocatalyst showed the highest hydrogen evolution activity. The results of work function, electrochemistry and photoelectric conversion indicated that Schottky junction was formed between CoB and g‐C3N4, which could improve the separated rate of photoinduced charge, meanwhile, loaded CoB lowed the hydrogen production overpotential of g‐C3N4. Hence, this study provides more possibilities for the application of photocatalysis.