Carbide-derived Carbons (CDC) with monodisperse ultramicroporosity have been prepared by carbide fluorination thanks to selective etching of metallic element. The chosen carbides precursors were titanium and niobium carbides, and silicon carbides from interstitial and covalent carbide family, respectively. Direct fluorination proceeding by a pure flow of 1 atm. of molecular fluorine is the only fluorination way which leads to the transformation of the powdered and highly crystallized carbide into some carbons. Materials with different ratio of carbon and solid titanium trifluoride were successfully obtained by direct fluorination of titanium carbide, characterized by quantitative XRD, IR and Raman spectroscopies and Scanning and Transmission Electronic Microscopies and used in supercapacitors. The direct fluorination of silicon carbide in order to form carbon is more difficult because of the competition between carbon formation and its degradation into gaseous carbon fluorides. To success in our goal, thin film morphology was used as precursor. However, an accurate fluorination way is needed and decomposition of XeF2 fluorinating agent was chosen. Thin films with variable thickness of nanostructured carbon at the surface were obtained and used as solid lubricant with tunable wettability properties.