The electrical potential in a closed surface such as a cavity containing counterions only is derived for the cases of constant surface potential and constant surface charge density. The results obtained have applications in, for example, microemulsion-related systems in which ionic surfactants are introduced to maintain the stability of a dispersion and electroosmotic flow-related analysis. An analytical expression for the electrical potential is derived for a planar slit, and the methodology used is modified to derive approximate analytical expressions for spherical and cylindrical cavities. The higher the surface potential, the better the performance of these expressions. For the case where the surface potential is above ca. 50 mV, the performance of the approximate analytical expressions can further be improved by multiplying a correction function.