In this study, mesoporous TiN spheres with tunable diameter have been fabricated via a facile template-free strategy. Under ammonia atmosphere, mesoporous TiO₂ spheres are directly converted into mesoporous TiN spheres with the addition of cyanamide to retain the original morphology. The electrochemical performance of the resultant mesoporous TiN spheres demonstrates that this material can be a promising electrode material for nonaqueous supercapacitors with high energy densities.