TaN thin films were deposited on Al2O3 wafers by DC reactive magnetron sputtering. The composition control by nitrogen partial flux in the working gas and the electrical properties of the samples were investigated in detail. The results show that the atomic number ratio of Ta to N in the samples can be adjusted from 4 to 0.88, corresponding to the contents of N in the samples from 20 at.% to 53 at.%, by adjusting the nitrogen partial flux from 2% to 6%. The main phases in the TaNx thin films are hexagonal Ta2N, body centered cubic Ta10N and face centered cubic TaN at lower N contents (lower than 28 at.%). However, at higher N contents (higher than 28 at.%), orthorhombic Ta3N5 phase gradually precipitates out from the samples, and the hexagonal Ta2N phase disappears. When the N contents in the samples are lower than 28 at.%, the sheet resistance and resistivity of TaNx thin films are all low. With further increase of the N contents, the sheet resistance and resistivity of TaNx thin films increase sharply. The sheet resistance and the resistivity of the samples can be adjusted from 17 Omega/sq. to 77 Omega/sq., from 344 muOmega ·cm to 1030 muOmega ·cm by adjusting the nitrogen contents, respectively. When the nitrogen contents in the samples are lower than 28 at.%, the TCR of the samples is less than 50 ppm/°C. With further increase of N contents, the TCR of the samples increases sharply up to a few hundred ppm/°C.