Generating multiple voltage levels requires a number of capacitors in a flying capacitor (FC) inverter, which is of crucial importance to the cost and power density of the whole system. Often the flying capacitance requirement is a tradeoff between accepted voltage ripple peak-to-peak value and the switching frequency of the inverter. Based on the popular phase-shifted pulsewidth modulation (PSPWM), the peak-to-peak value of the FC voltage ripple is first derived as a function of operating conditions in the time-domain. Since it is not an optimized way to simply adjust the flying capacitance for making the voltage ripple meet the requirement under constant switching frequency of the inverter, a variable switching frequency PSPWM (VSF-PSPWM) for FC voltage ripple control is presented in this article. From the point of view of FCs, the proposed VSF-PSPWM can satisfy the same requirement of the voltage ripple peak-to-peak value with a lower switching frequency and hence reduce the switching losses, comparing with the normal constant switching frequency PSPWM (CSF-PSPWM). Due to the real-time variation of switching frequency, the proposed VSF-PSPWM demonstrates the advantage in electromagnetic interference peak reduction. The simulation and experimental results are presented to evaluate the performance of the proposed method against the traditional CSF-PSPWM.