The present invention disclose a method and apparatus for pulse-width modulation (PWM) of a variable-frequency drive (VFD), the method comprising: for each sector of a space vector graph for PWM of the VFD, identifying at least two possible clamping phases in switching between the vectors in the sector; comparing currents in multiple phases in at least one PWM cycle; in the sector of the space vector graph corresponding to the PWM cycle, determining the possible clamping phase with the maximum current in the at least two possible clamping phases; and clamping the determined possible clamping phase with the maximum current.