A general salt-templating method to fabricate vertically aligned graphitic carbon nanosheets and their metal carbide hybrids for superior lithium ion batteries and water splitting.