Nanostructured carbon materials are potentially of great technological interest for the development of electronic, catalytic and hydrogen-storage systems. Here we describe a general strategy for the synthesis of highly ordered, rigid arrays of nanoporous carbon having uniform but tunable diameters (typically 6 nanometres inside and 9 nanometres outside). These structures are formed by using ordered mesoporous silicas as templates, the removal of which leaves a partially ordered graphitic framework. The resulting material supports a high dispersion of platinum nanoparticles, exceeding that of other common microporous carbon materials (such as carbon black, charcoal and activated carbon fibres). The platinum cluster diameter can be controlled to below 3 nanometres, and the high dispersion of these metal clusters gives rise to promising electrocatalytic activity for oxygen reduction, which could prove to be practically relevant for fuel-cell technologies. These nanomaterials can also be prepared in the form of free-standing films by using ordered silica films as the templates.