Consider a parallel plate capacitor connected to a battery. Work is done to move the electrons such that a potential difference is developed across the plates. Suppose, at time t, the plates have acquired charge q, the potential difference across the plates is expressed as the ratio of the acquired charge to the capacitance of the capacitor. Now, to increase the charge on the plates by a small amount, additional work done is expressed as the product of the potential difference between the plates and the additional charge acquired. Integrating the expression for the additional work done within the limits of zero to Q, the total work done to acquire a final charge Q can be obtained. Now, the potential energy gained by the capacitor equals the total work done to acquire charge Q, which can be expressed in terms of potential difference. Substituting for capacitance and potential difference in terms of electric field, the potential energy per unit volume of the capacitor gives the energy density between the charged capacitor plates.