This paper presents an enhanced machine learning based state of charge (SOC) estimation method for a lithium-ion battery using a deep recurrent neural network (DRNN) algorithm. DRNN is suitable for SOC evaluation due to strong computation intelligence and self-learning capabilities. Nevertheless, the performance of DRNN is constrained due to the training accuracy and duration which entirely depends on the appropriate selection of hyper-parameters including hidden layer and hidden neurons. Therefore, firefly algorithm (FA) is employed to find the optimal number for hyper-parameters of DRNN networks. The optimized DRNN based FA algorithm for SOC estimation does not require extensive knowledge about battery chemistry, electrochemical battery model and added filter, rather only needs battery test bench to measure current and voltage. The developed model is tested using two different types of lithium-ion batteries namely lithium nickel manganese cobalt oxide (LiNiMnCoO2) and lithium nickel cobalt aluminum oxide (LiNiCoAlO2). The proposed model is validated by two experimental tests; one with static discharge test and other with pulse discharge test at room temperature. The experimental results indicate the superiority of the DRNN based FA method in comparison with the back-propagation neural network (BPNN) and radial basis function neural network (RBFNN).