Designing a cost-effective and environmentally friendly heterogeneous catalyst for biodiesel production is essential. To achieve this, new 0.3-CaO-MgO/SBA-15 and 0.8-CaO-MgO/SBA-15 catalysts were prepared by the impregnation method. The new 0.3-CaO-MgO/SBA-15 catalyst had higher purity, larger surface area, and pore volume than 0.8-CaO-MgO/SBA-15, resulting in great catalytic activity for biodiesel production by transesterification of rapeseed oil with methanol. A biodiesel yield of 97.8 wt % was attained under the optimal reaction conditions of 5 wt % catalyst concentration, 15:1 methanol/oil molar ratio, 95C reaction temperature, and reaction time of 4 h. Most of the parameters and properties of the obtained biodiesel correspond to the EN 14212 standard. The 0.3-CaO-MgO/SBA-15 catalyst could be considered a potential candidate for biodiesel production on industrial level application attributed to intriguing properties like cost-effectiveness, ease of synthesis, and environmental greenness.