A method for cleaning a machine for liquid or semi-liquid products, the machine includes:a first container intended to contain a liquid or semi-liquid basic mixture or finished product and also provided with related means for thermal treatment of the liquid or semi-liquid basic mixture or finished product and a mixer. The method includes, in time sequence, the following steps:a) emptying the basic mixture contained in the first container;b) washing said first container with a washing fluid;c) at least partly filling the first container with a cleaning fluid and subjecting the cleaning fluid in the first container to a pasteurizing thermal treatment.