Methylene blue wastewater from the paper, clothing, and textile industries can adversely affect aquatic ecosystems if improperly treated. One method to treat methylene blue pollutants in sewage is through photocatalysis techniques using magnesium ferrite (MgFe2O4) nanoparticle-based semiconductors. The MgFe2O4 is effective for methylene blue degradation because it is stable in aqueous systems, inexpensive, and has good photocatalytic activity. This study aims to synthesize MgFe2O4 nanoparticles with pumpkin seed extract (Cucurbita moschata) as a capping agent through a hydrothermal method. Characterization results show that MgFe2O4 nanoparticles synthesized with the addition of 3 mL pumpkin seed extract have a crystal size of 3.87 nm, cubic spinel structure, average particle size of 29 nm, and band gap energy value of 1.94 eV. The MgFe2O4 nanoparticles produced optimum degradation efficiency under mercury lamp irradiation with a degradation capacity of 391.98 mg/g at pH 12. Copyright © 2024 by Authors, Published by BCREC Publishing Group. This is an open access article under the CC BY-SA License (https://creativecommons.org/licenses/by-sa/4.0).