TiN thin films have received great attention in the field of superconducting quantum computing due to their low loss characteristics derived from stable chemical and thermal properties, as well as excellent electrical conductivity. In this study, TiN thin films with a thickness of 35 nm were epitaxially grown on MgO substrates using dc reactive magnetron sputtering technique. 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, respectively. 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 film deposited with a N
2 flow rate of 1.5 sccm exhibits 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, it is found that the background vacuum inside the growth chamber has a significant impact on the superconducting properties of TiN films, and the degradation of vacuum degree can lead to the decrease of
Tc. The 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 two-dimensional superconducting behavior, which provides a new perspective on the influencing factors of superconducting dimensionality beyond the thickness of films. The present results provide useful references for a comprehensive understanding of the relationship between growth parameters and the superconducting properties of thin films.