Magnesium oxide nanoparticles (MgO-NPs) were synthesized using the solution-gelation (sol-gel) technique. For comparison, US Research Nanomaterials, Inc has supplied MgO with very high purity and used without further purification. Both nanoparticles were subjected to X-ray diffraction (XRD) pattern analysis for structural investigation. The XRD measurements showed an incredibly crystalline cubic structure. Morphological studies were carried out using scanning electron microscopy (SEM) measurements to examine the nanoparticles’ size and shape. SEM analysis of the synthesized sample’s morphology revealed a flake-like shape, while a spherical-like structure was observed in the case of the commercial MgO. Using X-ray peak broadening analysis, the Scherrer method was used to assess the crystallite size. A substantial correlation was found between the Scherrer formula and the average particle size of the MgO-NPs, which was determined through SEM analysis. The energy gap calculations were ascertained by plotting the photon energy utilizing the Tauc equation with the measurements of UV–visible absorption spectroscopy. Both nanoparticles were used against the bacterial activity of Streptococcus and Serratia bacteria. The results showed that synthesized nanoparticles exhibited greater effectiveness against bacterial activity than commercial ones.