Graphitic carbon nitride (g-C3N4) nanotubes (CNNTs) have been reported experimentally to have higher photocatalytic activity than normal g-C3N4 nanosheets, but the underlying reason is still unclear. In this work, the structural, electronic, and chemical properties of single-walled heptazine-based g-C3N4 nanotubes with two types of chirality and various diameters, as well as a g-C3N4 nanosheet, are investigated by the first-principles calculations. Similar to the nanosheet, the nanotubes also have a corrugated porous structure. Unlike carbon nanotubes, the CNNTs show comparable stability to the nanosheet, which may be ascribed to the rolled geometry for releasing the repulsion between lone-pair electrons of nitrogen atoms. With increasing diameter, the energy gaps of the (m, 0) CNNTs are increasing, while those of the (n, n) CNNTs are decreasing. And they are generally smaller than the gap of the nanosheet. This result indicates that the CNNTs would be capable of more visible-light absorption than the g-C3N4 nanosheet, which is consistent with previous experimental results. The valence band maxima (VBM) of both (m, 0) and (n, n) CNNTs are lower in energy than the oxidation potential of O2/H2O and the VBM of the nanosheet, which indicates that the CNNTs would have better photooxidation capability than the nanosheet. The results reveal a reasonable mechanism of the enhanced photocatalytic activity of CNNTs, which may offer strategies for designing potentially efficient photocatalysts.