Accurately estimating the remaining useful life (RUL) of batteries is crucial for optimizing maintenance, preventing failures, and enhancing reliability, thereby saving costs and resources. This study introduces a hybrid approach for estimating the RUL of a battery based on the firefly algorithm-neural network (FA-NN) model, in which the FA is employed as an optimizer to fine-tune the network weights and hidden layer biases in the NN. The performance of the FA-NN is comprehensively compared against two hybrid models, namely the harmony search algorithm (HSA)-NN and cultural algorithm (CA)-NN, as well as a single model, namely the autoregressive integrated moving average (ARIMA). The comparative analysis is based mean absolute error (MAE) and root mean squared error (RMSE). Findings reveal that the FA-NN outperforms the HSA-NN, CA-NN, and ARIMA in both employed metrics, demonstrating superior predictive capabilities for estimating the RUL of a battery. Specifically, the FA-NN achieved a MAE of 2.5371 and a RMSE of 2.9488 compared with the HSA-NN with a MAE of 22.0583 and RMSE of 34.5154, the CA-NN with a MAE of 9.1189 and RMSE of 22.4646, and the ARIMA with a MAE of 494.6275 and RMSE of 584.3098. Additionally, the FA-NN exhibits significantly smaller maximum errors at 34.3737 compared with the HSA-NN at 490.3125, the CA-NN at 827.0163, and the ARIMA at 1.16e + 03, further emphasizing its robust performance in minimizing prediction inaccuracies. This study offers important insights into battery health management, showing that the proposed method is a promising solution for precise RUL predictions. This study introduces a hybrid approach for estimating the remaining useful life of a battery in which the firefly algorithm is employed as an optimizer to fine-tune the network weights and hidden layer biases in a neural network. Graphical Abstract