In this paper, we demonstrated the preparation and electrochemical performance of mesoporous carbon foams as electrode materials for ultracapacitors. By using n-octane as oil phase, cetyltrimethylammonium bromide (CTAB) and butanol as emulsifiers, resorcinol and formaldehyde dissolved in water as the aqueous phase, an O/W microemulsion system was obtained. Mesoporous carbon foams (MCFs) were prepared by the polymerization of the O/W microemulsion, followed by drying and carbonization and subsequently activation at 1273 K by KOH under nitrogen atmosphere. The mesoporous carbon foams were characterized by scanning electron microscopy (SEM) and Brunauer-Emmett-Teller (BET) analyzer. The results show that MCFs have specific surface area of 666.7 m2/g, total pore volume of 0.36 cm3/g and the most probable pore size of 4 nm. The electrochemical properties of the resultant mesoporous carbon foams have been investigated by cyclic voltammetry (CV) and galvanostatic charge-discharge with a three-electrode system in electrolyte of 6 mol/L KOH solution. The CV curves show quite rectangular shape under the scan rate of 5-20 mV/s, suggesting a typical nonfaradic adsorption/desorption reaction. The mesoporous carbon foams possess linear galvanostatic discharge curves under the current densities of 10-50 mA/cm2 and corresponding specific capacitance values are 132.6-172.1 F/g. Thus the MCFs have good electrochemical performance and they provide an important candidate for electrode materials used in ultracapacitors.