A vacuum cleaner having self-cleaning function comprises a machine head assembly, a dust drum, a hose connected to the machine head assembly or the dust drum, and a filter connected to the machine head assembly, wherein the machine head assembly includes a fan, an air inlet and air outlet communicated with the outside, the hose has a suction mouthpiece communicated with the outside, the suction mouthpiece is communicated with the air inlet, the fan is provided between the filter and the air outlet, an air replenishing opening is provided between the filter and the fan, the filter has a clean side and a non-clean side, wherein the vacuum cleaner has a vacuum cleaning mode and a self-cleaning mode and in the vacuum cleaning mode, the air stream successively passes through the suction mouthpiece, the air inlet, the filter, the fan and the air outlet and in the self-cleaning mode, the air stream successively passes through the air replenishing opening and the fan, and then strikes the cleaning side of the filter, wherein an air replenishing valve is provided at the air replenishing opening and in the vacuum cleaning mode, the suction mouthpiece is opened and the air replenishing valve controls the air replenishing opening to be closed and in the self-cleaning mode, the suction mouthpiece is closed and the air replenishing valve controls the air replenishing opening to be opened, wherein the tube wall of the suction mouthpiece of the hose is pressed against the air replenishing valve so as to close the suction mouthpiece, and control the air replenishing valve to open the air replenishing opening, the tube wall of the suction mouthpiece of the hose is separated from the air replenishing valve so as to open the suction mouthpiece, and control the air replenishing valve to close the air replenishing opening, wherein the vacuum cleaner is further provided with an air replenishing mode and in the air replenishing mode, air stream successively passes through the air replenishing opening, the fan and the air outlet characterized in that: the vacuum cleaner has a first air chamber from the air inlet to the non-cleaning side of the filter, a second air chamber from the cleaning side of the filter to the fan, a third air chamber from the fan to the air outlet and a fourth air chamber from the air outlet to the cleaning side of the filter, wherein the fourth air chamber is provided with a self-cleaning air port adjacent to the air outlet, wherein when the vacuum cleaner is in the vacuum cleaning mode, the suction mouthpiece and the air outlet are opened and the air replenishing opening is closed, so that external air stream successively passes through the suction mouthpiece, the air inlet, the first air chamber, the second air chamber and the third air chamber, and is discharged from the air outlet; wherein when the vacuum cleaner is in the air replenishing mode, the air outlet and the air replenishing opening are opened, and the suction mouthpiece is closed, so that the external air stream successively passes through the air replenishing opening, the second air chamber and the third air chamber, and is discharged from the air outlet; and wherein when the vacuum cleaner is in the self-cleaning mode, the air replenishing opening is opened, the suction mouthpiece and the air outlet are closed, so that the external air streams successively pass through the air replenishing opening, the second air chamber, the third air chamber and the fourth air chamber, and then enters the second air chamber for circulation after passing through the cleaning side of the filter. a machine head assembly, a dust drum, a hose connected to the machine head assembly or the dust drum, and a filter connected to the machine head assembly,