A washing machine comprising: a tub for storing water; a drum rotatably provided in the tub; a driving unit rotating the drum; a water supply unit supplying water supplied from an external water source to the tub; a pump having a pump motor and pressure-feeding water discharged from the tub; a nozzle spraying the water pressure-fed by the pump into the drum; a heater heating the water in the tub; and a controller controlling the driving unit, the water supply unit, the pump motor, and the heater, wherein the controller controls the water supply unit to supply water by a first set amount together with a detergent to the tub, controls the driving unit to rotate the drum at a first drum rotation speed while water is being supplied, rotates the pump motor at a first pump rotation speed during the rotation of the drum at the first drum rotation speed, operates the heater in a state in which the first set amount of water is supplied to the tub, controls the driving unit to rotate the drum at the second drum rotation speed during the operation of the heater, and operates the pump motor at a second pump rotation speed during the rotation of the drum at the second drum rotation speed, the second pump rotation speed being lower than the first pump rotation speed, stops the operation of the heater, controls the driving unit to rotate the drum at the third drum rotation speed in a state in which the operation of the heater is stopped, and rotates the pump motor at the third pump rotation speed during the rotation of the drum at the third drum rotation speed in a state in which the operation of the heater is stopped, wherein a ratio of a stop time of the drum to a rotation time of the drum when the heater is operated is greater than a ratio of a stop time of the drum to a rotation time of the drum when water is supplied to the tub. a tub for storing water; a drum rotatably provided in the tub; a driving unit rotating the drum; a water supply unit supplying water supplied from an external water source to the tub; a pump having a pump motor and pressure-feeding water discharged from the tub; a nozzle spraying the water pressure-fed by the pump into the drum; a heater heating the water in the tub; and a controller controlling the driving unit, the water supply unit, the pump motor, and the heater, wherein the controller controls the water supply unit to supply water by a first set amount together with a detergent to the tub, controls the driving unit to rotate the drum at a first drum rotation speed while water is being supplied, rotates the pump motor at a first pump rotation speed during the rotation of the drum at the first drum rotation speed, operates the heater in a state in which the first set amount of water is supplied to the tub, controls the driving unit to rotate the drum at the second drum rotation speed during the operation of the heater, and operates the pump motor at a second pump rotation speed during the rotation of the drum at the second drum rotation speed, the second pump rotation speed being lower than the first pump rotation speed, stops the operation of the heater, controls the driving unit to rotate the drum at the third drum rotation speed in a state in which the operation of the heater is stopped, and rotates the pump motor at the third pump rotation speed during the rotation of the drum at the third drum rotation speed in a state in which the operation of the heater is stopped, wherein a ratio of a stop time of the drum to a rotation time of the drum when the heater is operated is greater than a ratio of a stop time of the drum to a rotation time of the drum when water is supplied to the tub.