N-doped TiO2 NTAs were prepared by a facile one-step anodization method. N-doping level of the TiO2 can be tuned by changing NH4F quantity in electrolyte. NH4F quantity influences tube length and photoluminescence intensity of the TiO2. Photocatalytic activity of the TiO2 can be enhanced by regulating NH4F quantity. Photodegradation and photocatalytic H2 production mechanisms were explored.