In this work, magnesium ferrites nanoparticles (MgFe2O4 NPs) were successfully fabricated by sol-gel auto-combustion (SGAC) method and were used in heterogeneous Fenton-like degradation of tartrazine. The obtained products were characterized using XRD, FTIR, SEM and EDX. XRD studies confirmed that the synthesized MgFe2O4 NPs had a cubic spinel structure. The average crystallite size was evaluated using the Debyee Scherrer formula and found to be in the range 16.18–28.55 nm. In FTIR spectra, two primary absorption bands at 571 cm−1 and 415 cm−1 were observed. The spinel ferrites are characterized by these bands and the EDX confirms the presence of the desired elements Mg, Fe, and O. The influences of operating parameters were examined using the Box Behnken statistical design (BD), including magnesium ferrite dosage (0.04–0.12 g/L), tartrazine concentration (30–50 mg/L) and H2O2 concentration (3.53–7.06 mM). Using analysis of variance, a significant quadratic model was created. Optimum conditions were magnesium ferrite dosage of 0.092 g/L, tartrazine concentration of 30.21 mg/L and H2O2 concentration of 6.66 mM, respectively. The predicted degradation efficiency within the optimum conditions as established by the suggested model was 98.4%. Confirmatory tests were carried out and the degradation efficiency of 98.9% was observed, which was in good agreement with the model's prediction. After five recuperation and reapplications, the catalyst's degradation efficiency remains stable. These findings indicate that a heterogeneous Fenton-like process utilizing MgFe2O4 is effective in advanced wastewater treatment.