The invention discloses a method for calculating the moisture of raw coals in a medium-speed coal mill online. The method comprises the steps of calculating the moisture of pulverized coals, calculating sealing air flow, calculating a pebble coal amount, calculating a heat preservation coefficient of the medium-speed coal mill, calculating heat released by primary hot air, calculating heat absorbed by the raw coals and sealing air, calculating heat taken away by pebble coals, plugging each data into a heat balance equation, setting a contrast test and verifying the moisture of the raw coals, and replacing a coal type and repeating the contrast test until a stable parameter value is obtained. The invention discloses the method for calculating moisture of the raw coals in the medium-speed coal mill online. A ground product of the medium-speed coal mill is sampled and tested, the moisture of the raw coals is calculated through a heat balance equation, multiple sets of contrast test verification are set, a calculation error of the raw coal moisture is reduced, the accurate judgment on the coal type is facilitated to reasonably control the outlet temperature of the coal mill, boiler operation parameters are adjusted to optimal values, and therefore the heat energy conversion rate of the raw coals is improved.