Hi. I put the simplest case. A capacitor formed by two flat metal plates faced in the vacuum, with charges of the same absolute value in both plates. In this case, the electric field of the capacitor, in a static situation, has an energy expressed in the following way.
E=\dfrac{q^2}{2 \ C}
Now...