The invention relates to a hub motor. The hub motor of the invention includes a motor shaft, a stator, a casing, a rotor, and a deflector. The deflector has a windward surface, and the windward surface is used to guide the airflow in the heat dissipation channel to blow to the heat-generating components in the casing. The heat-generating components in the casing dissipate heat, and the deflector is movably arranged on the casing. Compared with the way of direct ventilation in the prior art, the deflector of the present invention guides the airflow to the heat-generating components in the casing, which can improve the temperature of the machine. The heat-generating parts in the casing can dissipate heat better, and the deflector is movable on the casing. When the casing rotates, under the action of gravity, the posture of the deflector changes, changing the position where the airflow blows to the heating components in the casing, so that The heat-generating components in the casing are heated more evenly, so that the heat-dissipating airflow in the casing can evenly dissipate the heat-dissipating effect on the heat-generating components in the casing, which solves the poor heat dissipation effect caused by the poor uniformity of the internal heat-dissipating airflow in the current air-cooled hub motor question.