Method for operating a water heater for heating water in accordance with the through-flow principle, wherein the water heater has a connection to a cold-water inlet line, a connection to a warm-water outlet line and a heat generator which is able to be switched on and off, wherein, between the heat generator and the warm-water outlet line, a total water stream flowing through the water heater is able to be divided between a bypass device and a buffer device and merged again, characterized in that, in a second operating mode, if a target warm-water outlet temperature is lower than a water temperature which is established at a minimum heating power of the heat generator, as soon as and for as long as cold water is present on the outlet side in the buffer device: • the heat generator switches on and heats the total water stream, • this warm total water stream is divided into two warm partial water streams, • a first warm partial water stream flows through the bypass device to the warm-water outlet line, • a second warm partial water stream flows into the buffer device where it displaces a cold partial water stream of equal volume, which subsequently flows to the warm-water outlet line, • the first, warm partial water stream and the second, cold partial water stream merge in the mixing device, are mixed to a target water temperature, and flow to the user via the warm-water outlet line, and as soon as and for as long as warm water is present on the outlet side in the buffer device: • the heat generator switches off, and the total water stream flows through the heat generator without being heated, • this cold total water stream is divided into two cold partial water streams, • a first cold partial water stream flows through the bypass device to the warm-water outlet line, • a second cold partial water stream flows into the buffer device where it displaces a warm partial water stream of equal volume, which subsequently flows to the warm-water outlet line, • the first, cold partial water stream and the second, warm partial water stream merge in the mixing device, are mixed to a target water temperature, and flow to the user via the warm-water outlet line. • the heat generator switches on and heats the total water stream, • this warm total water stream is divided into two warm partial water streams, • a first warm partial water stream flows through the bypass device to the warm-water outlet line, • a second warm partial water stream flows into the buffer device where it displaces a cold partial water stream of equal volume, which subsequently flows to the warm-water outlet line, • the first, warm partial water stream and the second, cold partial water stream merge in the mixing device, are mixed to a target water temperature, and flow to the user via the warm-water outlet line, and • the heat generator switches off, and the total water stream flows through the heat generator without being heated, • this cold total water stream is divided into two cold partial water streams, • a first cold partial water stream flows through the bypass device to the warm-water outlet line, • a second cold partial water stream flows into the buffer device where it displaces a warm partial water stream of equal volume, which subsequently flows to the warm-water outlet line, • the first, cold partial water stream and the second, warm partial water stream merge in the mixing device, are mixed to a target water temperature, and flow to the user via the warm-water outlet line.