In order to relieve the pressure of power grid which is caused by massive unguided charging behavior of electric vehicles, as well as maintains the safe and stable operation of the power grid, this paper presents an optimal charging strategy for electric vehicles. The main idea of this strategy is to make charging plan through time-of-use electricity price, and the electric vehicle can be moved to normal period and valley period for charging. The objective function of the algorithm is to minimize the charging cost and the peak-valley difference, based on this system, this paper builds a mathematic model of multi-objective optimization. Aiming at the problem of large-scale and high real-time requirement, the artificial fish swarm algorithm is used to solve the model.In addition,the algorithm optimizes charging continuity,which can effectively prevent load curve mutation and protect charging facilities. The simulation results in MATLAB verify the validity and stability of charging strategy.