In this present research, magnetic nanoparticles of ZIF-8/NiFe2O4 were synthesized using a green and simple method to photodegrade methylene blue in presence of visible-light irradiation. The structures and morphologies properties of the as-synthesized nanoparticles were characterized by XRD, FTIR, SEM, TEM, and PL for individual ZIF-8, NiFe2O4, and ZIF-8/NiFe2O4 materials. Response surface method (RSM) by considering the central composite design (CCD) was used to design the experiments and optimize the process. The F-value (248.26) and p-value < 0.0001 imply that the model is significant. The obtained RSM model with R2 = 0.996 showed a satisfactory correlation between the predicted values and experimental results of MB removal. The maximum decolorization efficiency of MB was obtained under the optimum experimental conditions of 0.044 g/100mL catalyst dose, 5 mg/L initial dye concentration, 150 min irradiation time, and dye solution pH of 7.4.