Cell balancing control for Li-ion battery pack plays an important role in the battery management system. It contributes to maintaining the maximum usable capacity, extending the cycle life of cells, and preventing overheating and thermal runaway during operation. This paper presents an optimal control of active cell balancing for serially connected battery pack that maintains the cell’s current and temperature in a suitable range during the equalizing process. Using the cell-to-cell balancing circuit based on CuK converter for two adjacent cells, the state of charge (SoC) and temperature dynamic of cells in the pack are modeled. Then, the optimal control problem for active cell balancing is established with constraints on cells’ current and temperature. The solution of this nonlinear optimal problem solved using sequential quadratic programming (SQP) is the optimal duty fed to the cell balancing circuits. The experimental test is applied to the battery pack of seven Samsung cells connected in series, and the reliable and efficient results show that the cell balancing process takes place shortly and adaptively depending on the discharge/charge current of the pack, the desired temperature increasing limit, and technical constraints of balancing circuits.