TiN thin films have received great attention in the field of superconducting quantum computing due to their low loss characteristics derived from stable chemical properties. In this study, TiN thin films with a thickness of 35 nm were epitaxially grown on MgO substrates using dc reactive magnetron sputtering technology. The crystal structure, film thickness, and surface morphology of the thin films were characterized using X-ray diffraction, X-ray reflection, and atomic force microscopy. The films exhibit a very flat surface with a root mean square roughness of only a few tenths of a nanometer. The influences of nitrogen (N
2) flow rate on the surface morphology, superconducting transition temperature (
Tc), residual resistivity ratio (RRR), normal-state resistivity (
ρn), upper critical field, and superconducting dimensionality were investigated systematically. The experimental results show that TiN films deposited with a N
2 flow rate of 1.5 sccm exhibit optimal performance, including the highest
Tc (4.93 K), the largest RRR, the lowest
ρn, and the lowest slope of the out-of-film upper critical field near
Tc. Moreover, the experiment shows that the background vacuum inside the growth chamber has a significant impact on the superconducting properties of TiN films, and its decrease can lead to the decrease of
Tc. Upper critical field reveals a significant anisotropic feature. Importantly, the in-film upper critical field data demonstrates that the optimization of sample quality leads to deviation from 2D superconducting behavior, which provides a new perspective on the influencing factors of superconducting dimensionality beyond the thickness of films. The present result provides useful references for a comprehensive understanding of the relationship between growth parameters and the superconducting properties of thin films.