The invention provides a method for preparing tofacitinib citrate. The method for preparing tofacitinib citratecomprises the following steps that1, N-methyl-N-((3R,4R)-4-methylpiperidine-3-yl)-7H-pyrrolo[2,3-d]pyrimidin-4-amine and ethyl cyanoacetate are added into methyl alcohol for condensation reaction to prepare and obtain 3-((3R,4R)-4-methyl-3-(methyl(7H-pyrrolo[2,3-d]pyrimidin-4-yl)amino)piperidin-1-yl)-3-oxopropanenitrile;and 2,3-((3R,4R)-4-methyl-3-(methyl(7H-pyrrolo[2,3-d]pyrimidin-4-yl)amino)piperidin-1-yl)-3-oxopropanenitrileis added to a mixed solvent and subjected to 80+ / -5 DEG reflux, additionally, citric acid is dissolved in the mixed solvent and then added slowly to a reflux system forsalt forming reaction, cooling, filtration, washing, and drying to obtain 3-((3R,4R)-4-methyl-3-(methyl(7H-pyrrolo[2,3-d]pyrimidin-4-yl)amino)piperidin-1-yl)-3-oxopropanenitrile citrate. According to the method for preparing tofacitinib citrate, operation isconvenient, time consumption isless, the yield rate is high, product impurity is low,and purity is good.