In this method for producing 2-anilino-4,6-dimethylpyrimidine by reacting phenylguanidine and/or one of its salts with acetylacetone the reaction takes place in the presence of water and/or without separating the amounts of water that are formed during the reaction. Phenylguanidine carbonate and phenylguanidine hydrogen carbonate preferably in a water-moist form are used for this reaction which is preferably carried out at pressures between 0.1 and 10 bar and at temperatures between 40 and 180° C. In this manner a finely crystalline product of high purity is obtained in very good yields by a technically simple method.