Accurate state-of-charge (SOC) estimation is a crucial part of the battery management system (BMS). However, conventional estimation methods are unable to capture the extremely complex dynamic characteristics of lithium-ion batteries. Besides, manually setting the optimal hyperparameters of models has many drawbacks. To address the problems, an (improved whale optimization algorithm) IWOA- (long short-term memory) LSTM model is proposed in this work. Utilizing the whale optimization algorithm (WOA) improved with four enhancement strategies (Gaussian chaotic mapping initialization, Nonlinear weight update, Lévy flight mechanism, and Elite opposition-based learning) to optimize the number of hidden layer nodes, the learning rate, and the number of iterations of LSTM model. It not only overcomes the shortcomings of artificially setting LSTM hyperparameters but also further boosts the learning ability of the IWOA-LSTM model, making the model more suitable for SOC estimation under different scenarios. The evaluation results show that the MAE of the proposed model for SOC estimation results is lower than 0.8 % under different temperatures and dynamic conditions. Compared with SOTA models, all MAE, RMSE, and MAPE of the proposed model substantially decline. Furthermore, the R2 of the estimation results using the LG dataset in Experiment Ⅲ is 98.65 %, suggesting the applicability of the proposed model to Li-ion batteries from various manufacturers. The experimental results demonstrate the proposed IWOA-LSTM model is suitable for accurate SOC estimation.