A method for cleaning an inline optical sensor in a system which comprises: a flowcell comprising a chamber with an inlet and an outlet; one or more flushing channels (56, 57) which debouch in the chamber; wherein the sensor comprises one or more substantially transparent windows (51, 52) arranged in the chamber, the sensor being arranged for sensing an optical property of a liquid flowing through the chamber, the one or more substantially transparent windows (51, 52) being arranged for spacing a light source and/or a light detector of the sensor apart from the liquid flowing through the flowcell; characterized in that the method comprises the steps of: blocking flow of liquid through the inlet into the chamber; supplying air pressurized at a first air pressure to the chamber for substantially emptying the chamber from liquid; and dispensing an amount of cleaning liquid, and using air pressurized at a second air pressure, vaporizing said amount of cleaning liquid to obtain a cleaning liquid/pressurized air mixture and delivering said mixture via the one or more flushing channels onto the one or more windows (51,52) in the chamber; wherein the second air pressure is greater than ambient pressure and at least two times smaller than the first air pressure; letting the cleaning liquid from the mixture act on the one or more windows onto which the mixture has been delivered, for at least a predetermined amount of time; and flushing the chamber with hot water which has a temperature of at least 80 degrees Celsius. a flowcell comprising a chamber with an inlet and an outlet; one or more flushing channels (56, 57) which debouch in the chamber; wherein the sensor comprises one or more substantially transparent windows (51, 52) arranged in the chamber, the sensor being arranged for sensing an optical property of a liquid flowing through the chamber, the one or more substantially transparent windows (51, 52) being arranged for spacing a light source and/or a light detector of the sensor apart from the liquid flowing through the flowcell; characterized in that the method comprises the steps of: blocking flow of liquid through the inlet into the chamber; supplying air pressurized at a first air pressure to the chamber for substantially emptying the chamber from liquid; and dispensing an amount of cleaning liquid, and using air pressurized at a second air pressure, vaporizing said amount of cleaning liquid to obtain a cleaning liquid/pressurized air mixture and delivering said mixture via the one or more flushing channels onto the one or more windows (51,52) in the chamber; wherein the second air pressure is greater than ambient pressure and at least two times smaller than the first air pressure; letting the cleaning liquid from the mixture act on the one or more windows onto which the mixture has been delivered, for at least a predetermined amount of time; and flushing the chamber with hot water which has a temperature of at least 80 degrees Celsius. blocking flow of liquid through the inlet into the chamber; supplying air pressurized at a first air pressure to the chamber for substantially emptying the chamber from liquid; and dispensing an amount of cleaning liquid, and using air pressurized at a second air pressure, vaporizing said amount of cleaning liquid to obtain a cleaning liquid/pressurized air mixture and delivering said mixture via the one or more flushing channels onto the one or more windows (51,52) in the chamber; wherein the second air pressure is greater than ambient pressure and at least two times smaller than the first air pressure; letting the cleaning liquid from the mixture act on the one or more windows onto which the mixture has been delivered, for at least a predetermined amount of time; and flushing the chamber with hot water which has a temperature of at least 80 degrees Celsius.