► The ordered mesoporous carbon thin film was successfully synthesized. ► Synthesis route of mesoporous carbon using the soft template method. ► No obvious d-spacing contraction of the film during the carbonization. ► Great application potential in catalysis, absorption and electrochemistry.