Energy stored in a capacitor is electrical potential energy, thus related to the charge Q and voltage V on the capacitor.