Mg treatment is conducted in the production of peritectic steel, which greatly reduces the average value of incidence of transverse corner crack in continuous casting slab from 3.10% to 1.06% by 65.8%. In the industrial experiment with the stages of Ar station, before magnesium treatment, after magnesium treatment, and in the slab, the maximum Mg content is 30 ppm after Mg treatment. A large number of Mg containing complex inclusions are formed, and most of Al2O3 are transformed into MgO·Al2O3. In the inclusions, the content of MgO significantly increases from 3.58% to 27.2%. The number density of Mg containing inclusions increases from 45.2 to 168 mm−2. The oxide inclusions smaller than 2 μm account for more than 90%, indicating that Mg treatment can promote the refinement of inclusions. In the slab, most oxide inclusions are transformed into the complex inclusions with Mg containing oxides as the core covered by TiN and sulfide precipitates. These complex inclusions with a size above 1 μm can effectively promote the nucleation and growth of intragranular ferrite to prevent the generation of transverse corner cracks.