Carbon nitride(CN_x) films supported on fluorine-doped tin oxide(FTO) glass are prepared by radio frequency magnetron sputtering, in which the film thicknesses are 90-100 nm, and the element components in the CNX films are in the range of x = 0.15-0.25. The as-prepared CN_x is for the first time used as counter electrode for dye-sensitized solar cells(DSSCs), and show a preparation-temperature dependent electrochemical performance. X-ray photoelectron spectroscopy(XPS) demonstrates that there is a higher proportion of sp^2 C=C and sp^3 C-N hybridized bonds in CN_x-500(the sample treated at 500 ℃) than in CNX-RT(the sample without a heat treatment). It is proposed that the sp^2 C=C and sp^3 C-N hybridized bonds in the CN_x films are helpful for improving the electrocatalytic activities in DSSCs. Meanwhile, Raman spectra also prove that CN_x-500 has a relatively high graphitization level that means an increasing electrical conductivity. This further explains why the sample after the heat treatment has a higher electrochemical performance in DSSCs. In addition, the as-prepared CN_x counter electrodes have a good light transmittance in the visible light region. The results are meaningful for developing low-cost metal-free transparent counter electrodes for DSSCs.