The invention provides a three-dimensional printer with an automatic clearing function. The three-dimensional printer comprises a base, a support frame, a print
sprayer, a third driving mechanism, a fourth driving mechanism, a
material storage box, a feeding
pipe, a feeding device, an
air blower and a controller, wherein the print
sprayer is driven by the third driving mechanism and the fourth driving mechanism to respectively move in a transverse direction and a longitudinal direction; the first end of the feeding
pipe is connected with the print
sprayer, the second end of the feeding
pipe is communicated with the
material storage box, a vent valve is arranged on the
material storage box, the feeding device comprises a material pushing plate and a cylinder, the material pushing plate is positioned in the material storage box, and the cylinder is connected with the material pushing plate; and a first air supply pipe is connected to the
air blower, an air supply connecting part is arranged at the end part, far from the
air blower, of the first air supply pipe, the air supply connecting part is fixed to the support frame through a connecting rod, and a heating device is connected to the position, close to the air blower, of the first air supply pipe. The three-dimensional printer can automatically clear material residues in the print sprayer and the feeding pipe, so that the print work is more smooth.