Carbide-derived carbon (CDC) as an unconventional porous carbon material has been widely used for various applications. In this work, Ti3AlC2-derived porous carbon (Ti3AlC2-CDC) was electrochemically synthesized at 900°C and 3.0 V in molten CaCl2-NaCl. The obtained Ti3AlC2-CDC with abundant slit-like mesopores showed a high specific surface area of 425 m2/g. The variation of the morphology from the Ti3AlC2 precursor to Ti3AlC2-CDC was investigated, with the Ti3AlC2-CDC demonstrating a typical loose layered morphology and amorphous carbon structure. The intermediate products were also systematically analyzed to investigate the molten salt electrochemical etching process. It was found that Ti3AlC2 can be oxidized by residual O2− in the molten salt to form tiny Al2O3 particles on the anodic Ti3AlC2 surface during the etching process, then Ti3AlC2-CDC can be obtained by successively removing these Al2O3, Al, and Ti from the Ti3AlC2 precursor.