Ordered mesoporous titanium nitride-carbon (denoted as OM TiN-C) nanocomposite with high surface area (389 m(2) g(-1)) and uniform hexagonal mesopores (ca. 5.5 nm) was facilely synthesized via the soft-template method. As a structure-directing agent, Pluronic F127 triblock copolymer formed an ordered structure with inorganic precursors, resol polymer, and prehydrolyzed TiCl4, followed by a successive heating at 700 degrees C under nitrogen and ammonia flow. In this study, the amorphous carbon within the parent OM TiO2-C acted as a rigid support, preventing structural collapse during the conversion process of TiO2 nanocrystals to TiN nanocrystals. The OM TiN-C was then successfully applied as counter electrode material in dye-sensitized solar cells (DSCs). The organic electrolyte disulfide/thiolate (T-2/T-) was introduced to study the electrocatalytic property of the OM TiN-C nanocomposite. Because of the existence of TiN nanocrystals and the defect sites of the amorphous carbon, the DSCs using OM TiN-C as a counter electrode showed 6.71% energy conversion efficiency (platinum counter electrode DSCs: 3.32%) in the organic electrolyte system (T-2/T-). Furthermore, the OM TiN-C counter electrode based DSCs showed an energy conversion efficiency of 8.41%, whereas the DSCs using platinum as a counter electrode showed a conversion efficiency of only 8.0% in an iodide electrolyte system. The superior performance of OM TiN-C counter electrode resulted from the low charge transfer resistance, enhanced electrical conductivity, and abundance of active sites of the OM TIN-C nanocomposite. Moreover, OM TiN-C counter electrode showed better chemical stability in organic electrolyte compared with the platinum counter electrode.