The battery energy storage system has become an indispensable part of the current electricity network due to the vast integration of renewable energy sources (RESs). This paper proposes an optimal charging method of a vanadium redox flow battery (VRB)-based energy storage system, which ensures the maximum harvesting of the free energy from RESs by maintaining safe operations of the battery. The VRB has a deep discharging capability, long cycle life, and high energy efficiency with no issues of cell-balancing, which make it suitable for large-scale energy storage systems. The proposed approach determines the appropriate charging current and the optimal electrolyte flow rate based on the available time-varying input power. Moreover, the charging current is bounded by the limiting current, which prevents the gassing side-reactions and protects the VRB from overcharging. The proposed optimal charging method is investigated by simulation studies using MATLAB/Simulink.