The invention discloses a washing machine, comprising a base seat, a washing barrel, a driving component, a heating device, a pump, an water inlet pipe and a water drainage pipe, the washing barrel is rotationally provided on the base seat around a horizontal rotating center shaft, a washing cavity is defined inside the washing barrel; one end of the water inlet pipe extends into the washing cavity and the other end of the water inlet pipe extends out of the washing cavity, one end of the water drainage pipe extends into the washing cavity and the other end of the water drainage pipe extends out of the washing cavity, the water inlet pipe and the water drainage pipe are both relatively fixedly connected with the base seat; the heating device is located at the outside of the washing barrel and is used for heating the water flowing through the water inlet pipe, the pump has a water flow entrance, a circulating water outlet and a water drainage outlet, the water flow entrance communicates with one other end of the water drainage pipe, the circulating water outlet communicates with the other end of the water inlet pipe. According to the method of washing machine, the washing process can realize the function of single barrel washing, consumes less material, consumes less water, runs at lower cost, and can restrict the bacteria from breeding, thus keeping the surroundings of the washing machine cleaner.