The energy (U_C) stored in a capacitor is electrostatic potential energy and is thus related to the charge Q and voltage V between the capacitor plates. A charged capacitor stores energy in the electrical field between its plates. As the capacitor is being charged, the electrical field builds up.
[pdf]