The carbide distribution of M2 high speed steel (HSS) is not uniform during the solidification process. The effects of cerium (Ce) on the microstructure, primary carbides, and inclusions of M2 HSS are studied by combining experiment and theory. In the results, it is shown that the eutectic carbides of M2‐type HSS are MC‐ and M6C‐type cubic crystalline carbide and M2C‐type hexagonal crystalline carbide. The addition of rare‐earth elements does not change the type of carbides but changes their morphology. Among them, the shape factor K of the carbide increases from 0.3245 to 0.3736, and the volume percentage of the rare‐earth steel carbide decreases by 18% after 3D reconstruction. Notably, through first‐principles molecular dynamics calculations, it is shown that Ce strengthens the interaction between Fe and alloying elements in the molten state. The evolution sequence of inclusions is as follows: Al2O3 → CeAlO3, Ce2O2S → Ce2O3. The modified inclusions nucleate inhomogeneous on the primary carbide and are affected by the migration of dissolved cerium in the steel melt, resulting in a 23% thinning of the secondary dendrite arm spacing. In these results, theoretical guidance and practical guidance for improving the homogenization of as‐cast carbides are provided.