BackgroundThe disposal of waste spent coffee grounds (SCG) presents a pressing environmental concern, necessitating effective pre-treatment strategies to mitigate potential damage. Transesterification emerges as a viable solution for converting SCG lipids into biodiesel, offering both environmental and economic benefits. MethodsIn this study, the utilization of SCG as a renewable feedstock for biodiesel production through an innovative electrolysis process has been explored, aiming to address the dual challenges of waste management and sustainable energy production. To obtain maximum conversion of SCG oil to biodiesel, a comprehensive analysis of the fatty acid profile using Gas Chromatography-Mass Spectrometry (GC–MS), was conducted allowing for precise characterization of lipid content. Additionally, Fourier Transform Infrared (FTIR) spectroscopy was employed to categorize functional groups and Nuclear Magnetic Resonance (1H NMR) spectroscopy was utilized to analyze the molecular structure of the SCG oil. Optimization of process parameters namely, catalyst concentration, electrolysis time, and direct current (DC) voltage was performed using Response Surface Methodology (RSM) and Artificial Neural Network (ANN) techniques. The ANN model, with its ability to capture complex nonlinear relationships, was particularly effective in identifying the optimal combination of parameters, thereby maximizing biodiesel yield. Significant findingsThe extracted SCG oil was characterized using FTIR, GC–MS and 1H NMR analysis. The GC- MS analysis of bio-oil has reported 44.6 % Linoleic acid, 31.6 % Palmitic acid. The extracted oil had got significant amount of key saturated and unsaturated fatty acid making it suitable for transesterification process. Through ANN, the optimal combination of parameters for electrolytic transesterification i.e.,0.75 wt% catalyst loading, 2 h electrolysis time, and 40 V DC voltage, yielded the highest biodiesel production (98.32 wt.%). Comparative analysis indicated superior performance of the ANN model (R2 = 0.9931, MAE = 0.123) over RSM (R2 = 0.9636, MAE = 1.546). The artificial neural network (ANN) provided a more accurate forecast of the process yield; however, the RSM model effectively predicted the interactions and significance of the pyrolysis factors. The artificial neural network (ANN) provided a more accurate forecast of the process yield; however, the RSM model effectively predicted the interactions and significance of the pyrolysis factors. Biodiesel characterization via FTIR and 1H NMR analysis showed physiochemical properties within standard limits for SCG biodiesel.