Introduction

Water pollution has become a global threat to mankind due to accelerated pace of global industrialization1,2,3. According to sustainable development goal (SDG) 6.3, the provision of uncontaminated water and the development of safe and sustainable water purification methods are of paramount importance from environmental, industrial, and societal, and perspectives4. It is estimated that poor drinking water quality contributes to 80% of world’s diseases and 50% of child deaths5. Given the extensive contamination of water resources, there has been increasing endeavors towards developing safe and effective water treatment strategies over the recent decades6,7. According to the World Bank estimates, approximately 17–20% of global pollutants can be attributed to the textile industry8. The persistent nature of these pollutants stems from the stability of the water-soluble compounds used in textile industry such as dyes, resulting in prolonged environmental impacts. Carbol fuchsin (CF), a cationic organic dye that is used as a biological stain and in addition to other applications9. As per the regulations outlined in 29 CFR 1910.1200 by the Occupational Safety and Health Administration (OSHA), CF is categorized as a hazardous substance10. Furthermore, Carbol fuchsin has the potential to cause various health hazards, including chemical burns. Considering the available literature highlighting its potential environmental accumulation, especially in water, and its hazardous effects, novel methods for its safe and efficient removal should be considered11.

Traditional approaches to water treatment like coagulation, flocculation, sedimentation, and filtration, have been employed12,13. However, these methods often fall short in terms of efficiency and cost-effectiveness. Photocatalytic decomposition process is one of the most applicable processes that have been utilized for industrial dyes degradation14. The utilization of nanomaterials in wastewater treatment for removal of harmful dyes has been identified as a green and environmentally friendly approach which presents significant opportunities to revolutionize the approach for the removal of toxic dyes, particularly, magnetic nanoparticles15,16,17,18,19,20,21,22. Magnetic nanoparticles possess exceptional properties such as high surface area to bulk volume ratios, low toxicity, increased activity, thermal stability, adaptability for surface modifications, and efficient dispersibility23.

In recent years, the problem of multidrug-resistance and extensive drug-resistance to antibiotics has surged to a critical level that requires urgent intervention. The World Health Organization (WHO) has alarmingly warned that a "post-antibiotic era" has arrived in which previously treatable infections can become life-threatening due to antimicrobial resistance (AMR). This poses unimaginable risks to human and animal health in the twenty-first century. Additionally, there is decline in the development of new antibiotics due to elevated costs of development coupled with low return on investment24. According to a global report on tackling drug-resistant infections, AMR is expected to be the cause of death of one person every three seconds by 2050, if no novel therapeutic modalities were developed to combat AMR25. Inorganic nanoparticles with magnetic properties offer a promising solution for fighting antibiotic-resistant bacteria that don’t rely on targeted blocking of specific antibiotic resistance pathways. Instead, these nanoparticles rely on antimicrobial mechanisms such as reactive oxygen species (ROS) generation, delivery of metal ions, and magnetic hyperthermia to which the bacteria have not been able to evolve resistance mechanisms26,27.

Ferrites are chemical compounds with magnetic characteristics that present as powder or ceramic substances. Their ferrimagnetic characteristics are primarily attributed to iron oxides, specifically Fe2O3 and FeO, which can be partly replaced by other transition metal oxides28. Magnesium ferrite (MgFe2O4) is one of the most important ferrites. It has a cubic structure of normal spinel-type and is a soft magnetic n-type semiconducting material. It is utilized in various fields such as magnetic technologies, sensors, adsorption, and heterogeneous catalysis29. In recent years, nanostructures of magnetic materials have garnered increasing interest because of their exceptional material characteristics, which are particularly different from those of bulk materials30.

There is a growing interest in examining the antimicrobial properties of MgFe2O4 nanoparticles (NPs) that is driven by the escalating antimicrobial resistance towards conventional antibiotics and the potentially promising antimicrobial properties of MgFe2O4 magnetic nanoparticles31,32.

The current study has two key objectives. The first is to conduct an in-depth analysis of the efficacy of magnesium ferrite nanoparticles in water treatment, with a particular focus on their adsorption capabilities and photocatalytic properties. The second objective is to investigate their antimicrobial and antibiofilm activities against certain gram-positive and gram-negative bacterial strains. Through this comprehensive investigation, we aim to contribute to the development of more effective, sustainable, and safe solutions for water treatment and antimicrobial applications, thereby addressing the pressing global issue of water contamination and antibiotic resistance.

Materials and methods

Materials

The materials utilized in this study were ferric chloride hexahydrate (FeCl3·6H2O) and magnesium chloride hexahydrate (MgCl2·6H2O). Carbol fuchsin (CF) was obtained from Sigma Aldrich; purity ≤ 100%). All the chemicals were of analytical grade and were utilized without additional refinement. Distilled water was used in nanoparticle preparation experiments.

Synthesis of Mg Fe2O4 NPs

MgFe2O4 NPs were synthesized via the co-precipitation technique33. The desired chemical composition is achieved by combining equimolar quantities of magnesium chloride (MgCl2·6H2O) and anhydrous ferric chloride (FeCl3) dissolved in distilled water. The neutralization process is performed using a 1 M solution of sodium hydroxide (NaOH), with the reaction temperature held at 60 °C. The pH of the solution is maintained at 8 and stirring continues for duration of 2 h. The resulting precipitate is then washed with distilled water until it attains a state devoid of impurities. Subsequently, the product is subjected to drying at 100 °C to remove any remaining water content34.

Characterization of MgFe2O4 NPs

The composition of functional groups and surface characteristics of MgFe2O4 NPs were elucidated through FT-IR spectroscopy (JASCO FT-IR 3600 Infrared spectrometer). The samples under study were analyzed using the KBr disc method, with spectra recorded in the range of 400–4000 cm−1. X-ray diffraction (XRD) analysis was then conducted on the synthesized Mg-F NPs using a Shimadzu XRD-6000 apparatus (SSI, Japan) to evaluate crystallinity, phase composition, crystallite size, and lattice properties. The X-ray diffraction patterns were generated by measuring the intensity of diffracted X-rays as a function of the diffracted angle (2θ). The average crystallite size was determined using the Williamson–Hall (W–H) method, as described by (Eq. 1)35.

$$D = 0.9\lambda / \beta \cos \theta$$
(1)

In this context, the symbol (λ) signifies the wavelength of the employed radiation, whereas (β) and (θ) represent the full width at half-maximum (FWHM) and the angle corresponding to the peak with the highest intensity, respectively. The dimensions and morphology of the synthesized MgFe2O4 nanoparticles (NPs) were analyzed using a High-Resolution Transmission Electron Microscope (HRTEM, JEM2100, Jeol, Japan). The surface characteristics and grain size of these MgFe2O4 NPs were examined using Scanning Electron Microscopy (SEM, ZEISS, EVO-MA10, Germany). Additionally, an Energy Dispersive X-ray (EDX) analysis was conducted with a BRUKER Nano GmbH instrument (Model D-12489, 410-M, Germany) to determine the elemental composition, purity, and relative proportions of each metal within the structured MgFe2O4 NPs.

Antimicrobial activity testing of MgFe2O4 NPs

For antibacterial activity testing, gram-positive Staphylococcus aureus (ATCC 25923) and gram-negative E. coli (ATCC 25922) were selected as the target organisms to model two etiological agents of various infectious diseases in humans. The antimicrobial efficacy of the prepared Mg Fe2O4 NPs was qualitatively assessed using agar-disc diffusion and quantitatively using microbroth dilution methods36,37,38. Bacterial suspensions of 1.5 × 108 CFU mL−1 (0.5 McFarland density) obtained from 18 to 24 h bacterial cultures developed on Trypticase Soy agar (TSA) were used. Three Mg Fe2O4 NPs concentrations (10, 20 and 30 mg/ml) were prepared in DMSO and dispensed by sonication. Sterile filter paper discs (6.0-mm) were saturated by the Mg Fe2O4 NPs solution and placed on the culture and incubated at 37 °C for 24 h after which the zones of inhibition were recorded. Sterile filter paper was saturated with DMSO and used as control. For performance comparison, conventional antibiotic disc containing Gentamycin (CN) (Oxoid) at a concentration of 10 μg and with a diameter of 6.0 mm was employed39.

For quantitative determination of the minimum inhibitory concentration (MIC) of MgFe2O4 NPs, Macrobroth dilution technique was performed in test tubes containing Muller Hinton broth (MHB) of 2 mL total volume according to previously reported methods37. Two bacterial suspensions of gram-positive Staphylococcus aureus (ATCC 25923) and gram-negative E. coli (ATCC 25922) were collected after 24 h culture on Nutrient broth and adjusted to 0.5 McFarland standard turbidity (1.5 × 10−8 CFU/mL). Different concentrations of Mg Fe2O4 NPs (0.025, 0.05, 0.1 and 0.2) were tested. A positive control tube containing uninoculated broth with nanoparticles and a negative control tube containing inoculated broth without nanoparticles were included. The MIC values were determined by Multi Mode Microplate reader (Hidex Sense) spectrophotometer after 24 h incubation at 36.0 ± 1.0 °C as the lowest concentration at which no visible turbidity could be detected40.

Antibiofilm activity testing of MgFe2O4 NPs

A qualitative assessment of the antibiofilm activity of MgFe2O4 NPs was conducted by the tube adherence test according to the method outlined by a previous report41. Antibiofilm biofilm activity in the presence and absence of MgFe2O4 NPs at a concentration of 10.0 μg/mL. 5 mL of nutrient broth was introduced into both the treated and control tubes followed by the inoculation of the test bacteria (S. aureus, ATCC 25923) and (E. coli, ATCC 25922) at a concentration of 1.5 × 108 CFU mL−1 (0.5 McFarland density). Subsequently, tubes were incubated at 37.0 ± 0.5 °C for 24 h. The media in both the control and treated tubes was removed then the tube was filled with Phosphate Buffer Saline (PBS) at pH 7.0. Bacterial cells adhering to the tube walls were dislodged by treating with 5 mL of 3.5% sodium acetate for approximately 20 min, followed by a thorough cleaning with deionized water. Biofilm formed on the inner walls of the tubes was stained with 20 mL of 0.15% Crystal Violet (CV) and subsequently rinsed with deionized water to remove excess CV. For semi-quantitative assessment of antibiofilm activity of NPs, 5 mL of absolute ethanol was introduced to dissolve the stained bacterial biofilm38. The optical density (O.D.) of the stained bacterial biofilm was measured using UV–Vis (Biochrom.

WPA Biowave III) spectrophotometer at 570.0 nm39. The percentage inhibition of bacterial biofilm formation in the presence of MgFe2O4 NPs was calculated using the following equation (Eq. 2)40:

$$Biofilm\; inhibition \% =[(O.D. Control\; sample - O.D. treated\; sample) / O.D. Control\; sample] x 100$$
(2)

Photocatalytic degradation of Carbol fuchsin (CF) using MgFe2O4 NPs

A nanocomposite weighing 10 mg was introduced into a 50 ml aqueous solution containing Carbol fuchsin (CF) with an initial concentration (C0) of 10 mg/L. The mixture was stirred continuously at room temperature (25 °C) for 30 min in the absence of light to establish equilibrium between adsorption and desorption processes. Subsequently, a simulated UV light source, in the form of a UV lamp, was utilized to irradiate the solution containing the photocatalyst and CF. The UV lamp was positioned axially within a quartz immersion tube. At fixed time intervals during irradiation, a syringe equipped with a filter (pore size of 2.5 mm) was employed to extract a 1 ml sample of the CF suspension. The degradation rate of CF was determined by monitoring the change in CF concentration over the irradiation period using a UV–visible spectrophotometer (Agilent Technologies Cary 60 UV–visible) at a wavelength (λmax) of 545 nm. Deionized water served as the reference medium41.

Results and discussion

Characterization of the synthesized MgFe2O4 NPs

XRD analysis of MgFe2O4 NPs

Figure 1 illustrates the X-ray diffraction (XRD) patterns obtained for the synthesized MgFe2O4 nanocatalyst. The XRD patterns clearly reveal the presence of a cubic phase in the MgFe2O4 NPs, which can be matched to the standard JCPDS Card No. 22–1012(22–1042). In the diffraction patterns, each diffraction angle corresponds to a distinct peak, with notable peaks observed at approximately 2θ values of ~ 29.5°, 35.2°, 42.5°, 36.5°, 53.1°, 56.3°, and 62°28. The main diffraction peak at the (311) plane, with 2θ values around ~ 35.2°, is particularly noteworthy as it reflects the intensity of the cubic spinel ferrite. The average crystallite size was determined by analyzing the broadening of this diffraction peak, calculated using the Scherrer equation (Eq. 3)29,30:

$$D = K\lambda /\beta {\text{Cos}} \theta$$
(3)
Figure 1
figure 1

X-ray diffraction (XRD) patterns of the synthesized MgFe2O4 NPs.

In Eq. (3), (β) denotes the full width at half maximum (FWHM) of the diffraction peak, and K represents the shape factor. The shape factor, K, is approximately 0.9 and is equal to 0.15406, corresponding to the wavelength of CuK X-rays26. The crystallite size of the MgFe2O4 nanoparticles at the (311) plane, the most prominent peak, was determined to be 28.5 nm. It is noteworthy that the performance of nano photocatalytic substances is substantially influenced by their particle size.

Morphological analysis of Zn0.5Cu0.5Fe2O4 NPs

The SEM image of MgFe2O4 nanoparticles, as depicted in Fig. 2a, indicates that the synthesized particles have a spherical morphology and aggregate readily; their grain sizes range between 25 and 35 nm. It is crucial to note that the particle sizes shown in the SEM pictures may not completely reflect the real properties of the sample. The restriction arises from the potential for surface charge of the samples during their interaction with the electron beam. Electrostatic charging may increase, particularly when no atmosphere exists, as the electron beam moves across non-conductive metal oxide surfaces. These conditions can result in a decrease in SEM magnification and level of detail. In contrast, HRTEM showed that the synthesized MgFe2O4 NPs appears as a semi-spherical shape and small sizes as shown in Fig. 2b. The detected sizes varied from 20.7 to 30.6 nm and the average particle size was determined to be 27.3 nm.

Figure 2
figure 2

Electron microscopy images of the synthesized MgFe2O4 NPs. (a) SEM image of MgFe2O4 NPs. (b) HRTEM image of MgFe2O4 NPs.

Fourier transform infrared spectroscopy (FT-IR) analysis of MgFe2O4 NPs

The FT-IR spectrum of the synthesized MgFe2O4 nanoparticles (NPs), illustrated in Fig. 3, was obtained over a frequency range from 500 to 4000 cm−1. The spectra can be broadly classified into two main regions: the fingerprint region (400–1800 cm−1) and the lattice water H–O–H stretching band region (3200–3600 cm−1) 31,32. The characteristic absorption bands observed in the 550 to 700 cm−1 range are associated with the intrinsic vibrations of tetrahedral groups28. Furthermore, the absorption band at 1100 cm−1 can be ascribed to the stretching modes of metal–oxygen bonds (M=O), where molecules with a single terminal oxygen atom exhibit absorption32. Additionally, the peak observed at 1631 cm-1 corresponds to the bending vibration of O–H bonds in adsorbed water molecules present on the nanoparticle’s surface due to moisture adsorption. Furthermore, a peak at 3400 cm-1 is indicative of the stretching mode of adsorbed O–H groups.

Figure 3
figure 3

Fourier transform infrared spectroscopy (FT-IR) spectrum of the synthesized MgFe2O4 NPs.

UV–visible spectrophotometric and band gab analysis of MgFe2O4 NPs

Optical absorption was used to evaluate the energy gap of the nanostructures shown in Fig. 4a. The MgFe2O4 NPs have low absorbance in the visible regions and high absorbance in the ultraviolet region42. The UV–visible spectrum clearly illustrates that MgFe2O4 NPs exhibit significant absorption characteristics within the wavelength range of 250–400 nm, which originates primarily from the absorption and scattering of light by the MgFe2O4 NPs. This heightened absorptivity is attributed to the involvement of the hybridized Fe–d orbital43. The band gap energy was determined using the absorption spectra and the Tauc relation, as shown in the inset of Fig. 4b. The calculated band gap energy was approximately 2.2 eV. It is worth noting that a higher band gap energy leads to a reduction in the recombination rate of electron–hole pairs, thereby enhancing the photocatalytic properties of the material.

Figure 4
figure 4

UV–visible spectrophotometric and band gab analysis of MgFe2O4 NPs. (a) UV–visible absorption spectrum of the MgFe2O4 nanoparticles. (b) The band gap energy of synthesized MgFe2O4 nanoparticles.

Antimicrobial and antibiofilm activities of the synthesized MgFe2O4 NPs

Antimicrobial activity of MgFe2O4 NPs

The disk diffusion method was used to qualitatively assess the antimicrobial effectiveness of MgFe2O4 NPs against the gram-positive bacterium S. aureus (ATCC 25923) and the gram-negative bacterium E. coli (ATCC 25922). These particular strains were selected to model two clinically significant bacterial causes of several infectious diseases in humans. Additionally, their distinct cell wall structures might elicit varied reactions to the antimicrobial properties of MgFe2O4 NPs. As demonstrated in Fig. 5 and Table 1, 10ug/ml of MgFe2O4 NPs exhibited modest biocidal activity against both S. aureus and E. coli with zones of inhibition (ZOI) equivalent to 8 and 10 mm, respectively. However, a threefold increase in the concentration of MgFe2O4 NPs at 30ug/ml led to a proportional increase in biocidal activity against both S. aureus and E. coli with zones of inhibition equivalent to 23 and 26 mm, respectively. Enhanced growth inhibition effect was observed with the gram-negative bacterium E. coli compared to the gram-positive bacterium S. aureus. This differential inhibitory effect may be attributed to the distinct structure of their cell walls44. Further testing across a broader range of gram-positive and gram-negative bacterial strains is necessary to determine whether the observed antimicrobial activity of MgFe2O4 NPs is specific to certain species or broadly effective against both categories of bacteria. Consistent with the previous qualitative data, the quantitative antimicrobial assay via macrobroth dilution for MgFe2O4 NPs yielded an MIC value of 1.25 ug/ml for E. coli, which is half the MIC value yielded for S. aureus, at 2.5 ug/ml. This indicates that E. coli is more susceptible to MgFe2O4 NPs than S. aureus under the tested experimental conditions. The findings presented here align with other studies involving different metal nanoparticles, which have also demonstrated enhanced antimicrobial efficacy against E. coli relative to S. aureus45,46,47. Table 2 lists the reported antibacterial activity of different nanoparticles against S. aureus and E.coli from other studies, in comparison to our results.

Figure 5
figure 5

Antimicrobial activity of MgFe2O4 NPs by disk diffusion method. Antimicrobial activity of three concentrations of MgFe2O4 NPs; 10, 20 and 30 µg/ml was tested against (A) S. aureus ATCC 52923, (B) E. coli ATCC 25922 and assessed by measuring ZOI (mm). DMSO was used as a negative control and Gentamicin (10ug/disc) was used as a positive control. (C) Quantitative analysis of antimicrobial activity of MgFe2O4 NPs.

Table 1 Antimicrobial activity assays of MgFe2O4 NPs by disk diffusion and macrobroth dilution methods.

Antibiofilm activity of MgFe2O4 NPs.

Several bacterial species of clinical importance are known to develop biofilm that is associated with increased antibiotic resistance48,49. Consequently, the design of novel antimicrobial agents that specifically target biofilms is crucial. In the current study, the antibiofilm activity of MgFe2O4 NPs was tested on two specific bacterial strains known for their biofilm-producing capabilities; S. aureus (ATCC 25923) and E. coli (ATCC 25922) by the tube adherence test50,51. Both S. aureus and E. coli inoculated in the absence of MgFe2O4 NPs developed a thick whitish yellow biofilm at the air–liquid interface as demonstrated for E. coli in Fig. 6A. This biofilm appeared as a blue ring after CV staining and was adherent to the tube wall (Fig. 6B). After dissolving the CV-stained blue ring with ethanol, a blue suspension was formed (Fig. 6C). Conversely, S. aureus and E. coli that were treated with MgFe2O4 NPs demonstrated marked inhibition of biofilm formation observed before and after CV staining (Fig. 6). The highest inhibition percentage was observed against E. coli (89%) followed by S. aureus (78.5%) after treatment with 10.0 µg/ml of MgFe2O4 nanoparticles (NPs), as shown in (Fig. 6D and Table 1). Elbasuney et al.52 reported that the addition of 10.0 µg/mL of Ag-HA nanocomposite resulted in the highest inhibition percentages of 96.09% and 95.60% against S. aureus and E. coli, respectively52. The differential percentage inhibition of biofilm formation by MgFe2O4 NPs for E. coli versus S. aureus may be due to multiple factors including differential antimicrobial activity, and distinct chemical interactions governing the antibiofilm properties of the nanocomposite on various bacterial species44. Table 2 listed the antibacterial activity of different nanoparticles against the selected bacterial strains compared to the obtained results from this study.

Figure 6
figure 6

Antibiofilm activity of MgFe2O4 NPs E. coli using the tube adherence method. (A) Growth of bacterial cells and biofilm formation (rings) without treatment with MgFe2O4 NPs (left) and the inhibition of bacterial growth after treatment with MgFe2O4 NPs (right). (B) Staining of the adherent bacterial cells with crystal violet. (C) Removing and dissolving the adherent bacterial cells by ethanol for determination of quantitative biofilm inhibition (%). (D) Quantitative analysis of antibiofilm activity of MgFe2O4 NPs. The optical density (OD) of both the control sample (without MgFe2O4) and of the treated samples with 10ug/ml MgFe2O4 was measured at a wave length of 570 nm.

Table 2 Comparison of the antibacterial activity of different nanoparticles on S. aureus and E. coli by disk diffusion method.

Proposed mechanism of the antimicrobial effect of the synthesized MgFe2O4 NPs

An in-depth investigation is required to fully comprehend the antibacterial mechanism demonstrated by the synthesized  MgFe2O4 NPs. Figure 7 demonstrates a visual representation of the hypothesized antimicrobial action. It is understood that the activity of the synthesized MgFe2O4 NPs commences through their wrapping and adherence to the outer surface of microbial cells, resulting in membrane destruction and alteration of the transport potential. The MgFe2O4 NPs are posited to initiate contact by enclosing the outer layer of the microbial cells, leading to the breakdown of the cell membrane and alteration of the electrochemical gradient60. Following this initial interaction, the nanoparticles disseminate throughout the cell leading to cellular damage affecting bacterial genome, plasmid DNA, and other crucial organelles, primarily due to oxidative stress from reactive oxygen species (ROS) production. In the final stages, the nanocomposite impedes ion exchange with the across bacterial membranes26. However, morphological and topological features like shape, size, porosity, and surface roughness of NPs play a vital role in governing NP dissolution and antimicrobial efficacy61. Vishal Chaudhary et al. have proven that the size-dependent mechanism is the primary regulating element for the antibacterial efficacy and toxicity of AgNPs with diameters ranging from 1 to 10 nm62. Within this size range, Ag-NPs exhibit a higher dissolution rate than larger NPs. This is attributed to their increased surface-to-volume ratio, which aligns with the overall pattern of quantum size effects. Ag-NPs larger than 10 nm exhibit both ion-only and synergistic ion-particle processes, which ultimately act in a manner similar to their larger-scale counterparts. Furthermore, the structure of NPs also plays a crucial role in determining their antibacterial and dissolving performance. NPs with higher surface energy, such as nanoplates, dissolve faster than nanospheres. This is due to their smaller size and high-energy crystallographic aspects26.

Figure 7
figure 7

A model depicting the four main mechanisms underlying the antibacterial potential of the synthesized MgFe2O4 NPs. (I) MgFe2O4 NPs nanoparticles attach to and enfold the microbial cell surface, potentially via electrostatic interactions. (II) MgFe2O4 NPs penetrate the microbial cells and interact with cellular machinery components such as plasmid DNA, ribosomes, chromosomal DNA, and mesosomes, affecting their function. (III) MgFe2O4 induces the release and accumulation of ROS, leading to cellular damage. (IV) MgFe2O4 NPs modulate the cellular signal system and causing cell death. (V) Ultimately, the Mg-F nanoparticle composite impedes the bidirectional flow of ions across the microbial membrane.

Photocatalytic degradation of Carbol fuchsin (CF) using MgFe2O4 NPs

The removal of CF was monitored spectrophotometrically at its maximum absorbance wavelength, λmax = 545 nm63. Figure 8A clearly illustrates a progressive reduction in absorption peaks, indicative of CF dye photodegradation facilitated by the MgFe2O4 NPs photocatalyst, with increasing UV irradiation time. The calibration curve used for spectrophotometric analysis of CF samples was represented in Fig. 8B. As depicted in Fig. 8C, the photolytic degradation of CF amounted to only 7% after 135 min of UV irradiation. In contrast, the removal due to adsorption in the absence of light during the same timeframe was approximately 45.2%, as shown in Fig. 8C. On the other hand, the photocatalytic degradation of CF under UV light by MgFe2O4 nanocatalyst reached 76.0% after 135 min. This enhanced photocatalytic efficiency can be attributed to the presence of a metal–semiconductor heterojunction within the nanocomposite, which promotes effective charge separation and enhances light absorption.

Figure 8
figure 8

Photocatalytic degradation of Carbol fuchsin (CF) using MgFe2O4 NPs (a) Uv–Vis spectrum of CF after 15 min time interval using 10 mg of MgFe2O4 NPs under UV radiation. (b) Calibration curve of different concentrations of CF. (c) Percentage removal of CF photolysis is indicated by the black line, adsorption in dark by the red line, and UV photocatalysis by the blue line.

Effect of pH on Removal of Carbol fuchsin (CF) by MgFe2O4 NPs

In the context of dye removal studies, an important variable to consider is the dependence on the solution's pH. We investigated the influence of initial pH values in a 90-min experiment conducted under specified conditions (10 mg of MgFe2O4 NPs, 50 ml of CF solution (10 mg/L) at 25 °C). Figure 9 presents a graphical representation depicting the removal of CF over time at different pH values (3.0, 5.0, 7.0, and 9.0). Notably, the maximum CF removal at equilibrium was observed at pH 9.0 as illustrated in Fig. 9a.

Figure 9
figure 9

Effect of pH on removal of Carbol fuchsin (CF) by MgFe2O4 NPs. (a) Percentage removal of CF at different solution pH (5.0, 7.0 and 9.0). (b) Point of zero charge (PZC) of MgFe2O4 NPs at different pH values.

To determine the point of zero charge (PZC) of the MgFe2O4 nanocomposite, 0.01 g of MgFe2O4 NPs. was introduced into 50 mL of a 0.01 M NaCl solution. The pH of the solutions was adjusted using HCl or NaOH to achieve pH values of 2, 4, 6, 8, 10, and 12. Subsequently, the samples were stirred at 200 rpm for 48 h, and pH measurements were conducted after the magnetic separation of MgFe2O4 NPs.

The pH value at the Point of Zero Charge (PZC) was determined by plotting the final pH against the initial pH, as illustrated in Fig. 9b. The PZC pH was identified at pH = 6.9, where no significant difference existed between the final and initial pH values. This finding indicates that the surface charge of the MgFe2O4 NP photocatalyst is positive when the pH is below the PZC pH and negative when the pH exceeds the PZC threshold. Moreover, at the PZC pH, the surface charge of the photocatalyst becomes neutral, leading to minimal electrostatic interactions with ions such as CF ions. The calculated PZC pH value for MgFe2O4 NPs was found to be 6.9. The effective photocatalytic degradation of CF at pH 9.0, as shown in Fig. 9a, can be attributed to the negative net surface charge of MgFe2O4 NPs at this pH. This negative charge results in attraction between the negatively charged NPs and the positively charged CF, enhancing the degradation process. Conversely, the degradation of CF begins to decrease at pH 5.0, where the net surface charge of MgFe2O4 NPs becomes positive, leading to repulsion forces between the positive charge of CF and the positively charged surface of the NPs.

Effect of Initial Concentration of Carbol fuchsin (CF) on dye removal by MgFe2O4 NPs

We investigated the impact of varying the initial concentration of CF on its removal by MgFe2O4 nanoparticles (NPs) while maintaining constant reaction conditions. Figure 10a illustrates the variation in CF removal percentage over time for different initial CF concentrations (5.0, 10.0, and 15.0 mg/L). The findings indicate that as the initial CF concentration decreased from 5 to 15 mg/L, the removal efficiency increased. This suggests that even at low initial concentrations, CF can be effectively removed when exposed to UV light in the presence of the synthesized nanocomposite. This result could be explained by the Beer-Lambert Law, which states that an increment in initial dye concentration lowers the path length of photons exiting a solution. This reduces photon absorption by photocatalyst particles, drastically reducing the photocatalytic reaction rate64.

Figure 10
figure 10

(a) The variation of percent removal as a function of contact time at different initial CF concentration (5, 10 and 15 ppm) at pH 9.0 and 10.0 mg MgFe2O4 NPs, (b) Effect of the photocatalyst dose on the Removal efficiency of CF (50 ml CF solution (10 mg/l), Temp. = 25 0C and pH 9.0).

Effect of MgFe2O4 NPs dose on Carbol fuchsin (CF) degradation efficiency

The effect of varying doses of MgFe2O4 nanocomposite on the efficacy of CF removal under UV-light was studied by adjusting the quantity of the photocatalyst from 5 to 20 mg, with the CF concentration held constant at 10 mg/L, as illustrated in Fig. 10b. The results showed that the removal efficiency increased as the photocatalyst dose increased from 5 to 20 mg. The enhancement in removal efficiency with increasing photocatalyst quantity in the reaction could be attributed to the increased active area or active sites of the photocatalyst relative to the volume ratio of the CF solution65. Gao et al. reported similar behavior in dye degradation by using the cubic SrTiO366.

Kinetic studies

The CF removal rate can be computed using the following equation (Eq. 4):

$$-ln Ct/CO = - Kt$$
(4)

Here, Ct and Co denote the remaining and initial concentrations of CF, respectively, while t represents the removal time, and k represents the removal rate constant. Figure 11 illustrates the relationship between -ln(Ct/Co) and t. The findings indicated that the removal kinetics of the reaction adhered to pseudo-first-order rate kinetics. An increase in the initial concentration of CF led to a rise in the apparent pseudo-first-order rate constants, as seen in Fig. 11. The correlation between reaction rate constants and CF concentration is consistent with previous studies67.

Figure 11
figure 11

A linear fit, pseudo-first-order model data are reported in kinetic form for CF degradation under UV irradiation with beginning CF concentrations of 5, 10, and 15 ppm.

Mechanism of photocatalysis of Carbol fuchsin (CF)

As reported in multiple studies68,69,70, the potential mechanism can be elucidated as follows: photodegradation mechanisms are influenced by variations in pH levels and involve the participation of hydroxyl radicals, oxidation via positive holes in the valence band, and reduction by electrons in the conduction band. Photocatalytic degradation is expected to happen in the presence of MgFe2O4 NPs when UV light promotes the formation of electron–hole pairs on the surface of MgFe2O4 NPs71,72. These holes can either react with -OH groups to produce hydroxyl radicals or oxidize the reactive CF to create a degradation product due to their oxidative potential73,74. Equations (58) summarize the reactions between CF and the photocatalyst used.

$${\text{MgFe}}_{{2}} {\text{O}}_{{4}} {\text{NPs }} + {\text{ hv}} \to {\text{MgFe}}_{{2}} {\text{O}}_{{4}} {\text{NPs}}\left( {{\text{ e}}^{ - }_{{{\text{CB}}}} + {\text{ h}}^{ + }_{{{\text{VB}}}} } \right)$$
(5)
$${\text{h}}^{ + }_{{{\text{VB}}}} + {\text{ MgFe}}_{{2}} {\text{O}}_{{4}} {\text{NPs}} \to {\text{MgFe}}_{{2}} {\text{O}}_{{4}} {\text{NPs}}^{ + } \left( {\text{oxidation of the compound}} \right)$$
(6)

(Or)

$${\text{h}}^{ + }_{{{\text{VB}}}} + {\text{ OH}}^{ - } \to {\text{OH}}$$
(7)
$${\text{OH}}^{.} + {\text{ CF}} \to \left( {\text{Degradation products}} \right)$$
(8)

Figure 12 illustrates the suggested mechanism of the interaction between the produced MgFe2O4 nanoparticles and CF. When MgFe2O4 NPs are subjected to UV light, the excitation process generates charge carriers, initiating redox reactions. Consequently, the resultant free radicals, including OH· and O2·, participate in the degradation of CF, resulting in the formation of smaller organic compounds. It is noteworthy that, as of the current juncture, A few reports have been published regarding the degradation products of CF. Therefore, further investigations employing analytical techniques such as high-performance liquid chromatography (HPLC) and gas chromatography-mass spectrometry (GC–MS) are imperative for a more comprehensive analysis of CF degradation products. Table 3 listed the photocatalytic degradation activities of the different nanoparticles compared to the obtained results from this study.

Figure 12
figure 12

Potential photocatalytic reaction mechanism for CF photodegradation by MgFe2O4 NPs.

Table 3 Comparison of photocatalytic properties of different nanoparticles the literature.

Conclusion

MgFe2O4 NPs were successfully synthesized through a co-precipitation methodology and subjected to comprehensive structural and optical characterization. The photocatalytic performance of the resultant MgFe2O4 nanocatalyst was evaluated using CF dye as the target pollutant. Additionally, a thorough exploration of various factors affecting the degradation efficacy, including pH levels during CF degradation, initial CF concentration, and the dosage of MgFe2O4 NPs as photocatalysts, was conducted. The MgFe2O4 NPs demonstrated notable photocatalytic efficiency in the removal of CF from aqueous solutions. Remarkably, under conditions of pH 9 and utilizing 15 mg of MgFe2O4 NPs, approximately 96% of a 10 ppm CF solution was effectively photodegraded after 135 min. In vitro assessments further corroborated the antimicrobial potential of MgFe2O4 NPs, as evidenced by zone of inhibition (ZOI) and minimum inhibitory concentration (MIC) results. Specifically, MgFe2O4 NPs exhibited significant antimicrobial activity against E. coli (ZOI: 26.0 mm, MIC: 1.25 µg/ml) and S. aureus (ZOI: 23.0 mm, MIC: 2.5 µg/ml). The synthesized MgFe2O4 nanocatalyst holds promise for applications in antimicrobial treatments and wastewater purification processes.