A method of balancing voltages in a group of capacitors of a power electronic device, such as a multilevel power inverter, includes making a balancing determination regarding whether to (i) inject energy into the selected one of the capacitors from an energy storage element, or (ii) extract energy from the selected one of the capacitors into the energy storage element based on the voltage of a selected one of the capacitors, and either injecting energy into the selected one of the capacitors from the energy storage element, or extracting energy from the selected one of the capacitors into the energy storage element based on the balancing determination. Also, a voltage balancing circuit that implements the method. In one particular implementation, a spatial second derivative algorithm is used. In another particular implementation, a comparison to an average capacitor voltage is used.