We present a simple, top-down approach for the calculation of minimum energy consumption of electrosorptive ion separation using variational form of the (Gibbs) free energy. We focus and expand on the case of electrostatic capacitive deionization (CDI), and the theoretical framework is independent of details of the double-layer charge distribution and is applicable to any thermodynamically consistent model, such as the Gouy-Chapman-Stern (GCS) and modified Donnan (mD) models. We demonstrate that, under certain assumptions, the minimum required electric work energy is indeed equivalent to the free energy of separation. Using the theory, we define the thermodynamic efficiency of CDI. We explore the thermodynamic efficiency of current experimental CDI systems and show that these are currently very low, less than 1% for most existing systems. We applied this knowledge and constructed and operated a CDI cell to show that judicious selection of the materials, geometry, and process parameters can be used to achieve a 9% thermodynamic efficiency (4.6 kT energy per removed ion). This relatively high value is, to our knowledge, by far the highest thermodynamic efficiency ever demonstrated for CDI. We hypothesize that efficiency can be further improved by further reduction of CDI cell series resistances and optimization of operational parameters.