One of the most interesting facts is that the energy stored in a capacitor is related to the electric field between the conductors, that is the electric field itself stores the energy. Here talk about how the energy is stored in a capacitor and later retrieved back as the work done by electrical forces.
You'll soon find that storing energy in a capacitor is similar to stretching a spring, that is work is done on a spring and that work done is later recovered as the work done by the spring.
At first to a capacitor with no charge, transferring a small charge \(dq\) to the capacitor requires no work but as the capacitor has the charge the capacitor has the small potential difference and further transferring the charge increases the potential difference, so the work must be done against the resulting potential difference to store energy (to charge the capacitor) in the capacitor.
When the charging process is completed, let the final charge is \(Q\) and the final potential energy is \(V\), then we know \(V = Q/C\).
Consider the capacitor has charge \(q\) and potential difference \(v\) at some instant of the charging process. Then \(v=q/C\). The small work \(dW\) required to transfer small charge \(dq\) against the resulting potential difference is
\[dW = vdq\]
Now the total work required to transfer the charge \(Q\) is determined by integrating the above expression from \(0\) to \(Q\):
\[W = \int\limits_0^Q {\frac{q}{C}dq = \frac{{{Q^2}}}{{2C}}} \tag{1} \label{1}\]
From Equation \eqref{1}, the capacitance is inversely proportional to the work done and therefore it is easier to transfer charge to a capacitor with greater capacitance.
The amount of work done to charge a capacitor against the resulting potential difference is stored as the electric potential energy in the capacitor. And when discharging the capacitor that stored potential energy is recovered as the work done by electric field. So, the potential energy of a charged capacitor is
\[U = \frac{{{Q^2}}}{{2C}} = \frac{1}{2}C{V^2} = \frac{1}{2}QV \tag{2} \label{2}\]
The expression \(U = \frac{1}{2C}Q^2\) is similar to the expression \(U = \frac{1}{2}kx^2\) for the potential energy of a stretched string. So, from the analogy of a stretched string charging a capacitor is similar to stretching a string where the charge behaves as the elongation.
The expression for the potential energy in Equation \eqref{2} is the same for any capacitor regardless of its shape and size. Greater the capacitance greater the charge as we know \(C = QV\) and hence greater energy storage. When the charge and potential difference increase, the stored energy increases but there is a limit of maximum energy that can be stored on a capacitor. The discharge between the plates occurs at sufficiently high potential difference.
What is energy density of a capacitor?
As the charge is proportional to the electric field between the conductors of a capacitor, we can consider that the energy stored in the capacitor is stored in the electric field between the conductors. I mentioned this multiple times as the electric field itself being the storehouse of energy.
For the parallel-plates capacitor, considering the area of either plate \(A\) and separation \(d\), the volume between the plates is \(Ad\). And the electric field is related to the potential difference as \(V = Ed\). The capacitance for a parallel-plate capacitor is \((\epsilon _0A)/d\). Now from Equation \eqref{2} the stored energy in the volume between the plates is
\[U = \frac{1}{2}(\epsilon _0Ad)E^2\]
Now the energy density denoted by \(u\) is the stored energy in the volume divided by the volume, so
\[u = \frac{1}{2} \epsilon _0E^2 \tag{3} \label{3}\]
The above expression has been determined for the parallel-plate capacitor but this expression is generally valid for any capacitor in vacuum regardless of the electric field. The above expression shows that the energy density is proportional to the square of the magnitude of the electric field.