A pulse width modulation method for a three-level photovoltaic inverter, comprising: detecting whether an effective value of a common mode leakage current of the three-level photovoltaic inverter is greater than a first threshold; switching a pulse width modulation mode of the three-level photovoltaic inverter to a 13-vector space vector pulse width modulation, SVPWM, mode in a case of detecting that the effective value of the common mode leakage current of the three-level photovoltaic inverter is greater than the first threshold; after the switching the pulse width modulation mode of the three-level photovoltaic inverter to the 13-vector SVPWM mode, detecting whether the effective value of the common mode leakage current of the three-level photovoltaic inverter is not greater than a second threshold, wherein the second threshold is not greater than the first threshold; and switching the pulse width modulation mode of the three-level photovoltaic inverter to a discontinuous SVPWM mode in a case of detecting that the effective value of the common mode leakage current of the three-level photovoltaic inverter is not greater than the second threshold, wherein the 13-vector SVPWM mode is a SVPWM mode in which 12 short ones of 27 on-off state vectors of the three-level photovoltaic inverter are discarded and only 6 long vectors, 6 middle vectors and 3 zero vectors are reserved, and wherein the discontinuous SVPWM mode is a SVPWM mode in which the three-level photovoltaic inverter maintains that a certain one phase of power switch does not act within a switching cycle and the other two phases of power switches act two times within a switching cycle. detecting whether an effective value of a common mode leakage current of the three-level photovoltaic inverter is greater than a first threshold; switching a pulse width modulation mode of the three-level photovoltaic inverter to a 13-vector space vector pulse width modulation, SVPWM, mode in a case of detecting that the effective value of the common mode leakage current of the three-level photovoltaic inverter is greater than the first threshold; after the switching the pulse width modulation mode of the three-level photovoltaic inverter to the 13-vector SVPWM mode, detecting whether the effective value of the common mode leakage current of the three-level photovoltaic inverter is not greater than a second threshold, wherein the second threshold is not greater than the first threshold; and switching the pulse width modulation mode of the three-level photovoltaic inverter to a discontinuous SVPWM mode in a case of detecting that the effective value of the common mode leakage current of the three-level photovoltaic inverter is not greater than the second threshold, wherein the 13-vector SVPWM mode is a SVPWM mode in which 12 short ones of 27 on-off state vectors of the three-level photovoltaic inverter are discarded and only 6 long vectors, 6 middle vectors and 3 zero vectors are reserved, and wherein the discontinuous SVPWM mode is a SVPWM mode in which the three-level photovoltaic inverter maintains that a certain one phase of power switch does not act within a switching cycle and the other two phases of power switches act two times within a switching cycle.