Surface cracking is a major defect in the production of continuous casting slabs of peritectic steel. The difference in crystal structure between δ phase (before peritectic transformation of steel) and γ phase (after peritectic transformation) results in volume contraction, which leads to uneven cooling of mold and thus forming slab shells with different thicknesses. Then, coupled with the concentration of local stress, surface cracking occurs on slabs. In this paper, the effect of magnesium treatment on the hot ductility of Ti-bearing peritectic steel was studied, and the characteristics of solidification structure and TiN particles were analyzed. Magnesium treatment for Ti-bearing peritectic steel could significantly improve the hot ductility of continuous casting slabs by refining the original austenite structure. After the magnesium treatment, the average grain size of the original austenite of peritectic steel decreased by about 18.7%, and the size of Mg-rich TiN particles decreased by about 41%. In addition, the minimum reduction of area at the third brittle zone after the magnesium treatment was higher than 60%, and the fracture appearance changed from intergranular fracture to ductile fracture after the treatment. The contents of Mg, Ti, O, and N in peritectic steel and the cooling conditions were adjusted reasonably to promote the formation of highly dispersed Mg-rich TiN particles with a sufficient number density and a proper size in the initial solidification stage of peritectic steel, so as to induce the high-temperature δ-ferrite nucleation. Based on the fine δ structure formed by peritectic transformation, through the use of structure heredity and the pinning effect of secondary-precipitated nano TiN particles on the austenite grain boundary, a fine and dense original austenite structure could be obtained to improve the hot ductility of peritectic steel. Industrial tests showed that through the magnesium treatment, the surface cracks of Ti-bearing peritectic steel were effectively restrained, and the corner cracks of slabs were basically eliminated.