The g-C3N4 NTs have been successfully obtained by melamine polymerization in the presence of cobalt ions with simple method. The electrochemical studies show that nanotube structure of g-C3N4 has an excellent electrocatalytic activity for HER than the other structures