The internal energy of capacitive porous carbon electrodes was determined experimentally as a function of applied potential in aqueous salt solutions. Both the electrical work and produced heat were measured. The potential dependence of the internal energy is explained in terms of two contributions, namely the field energy of a dielectric layer of water molecules at the surface and the potential energy of ions in the pores. The average electric potential of the ions is deduced, and its dependence on the type of salt suggests that the hydration strength limits how closely ions can approach the surface.