This paper proposes an optimal algorithm for generating a train speed profile giving optimal energy efficiency based on GA (Genetic Algorithm) and shows its effectiveness with simulations. After simplifying the train operation mode to a maximum traction, a coasting and a maximum breaking, adjusting the coasting point to minimize the train consuming energy is the basic scheme. Satisfying the two constraints, running distance and running time between two stations, a coasting point is determined by GA with a fitness function consisting of a target running time. Simulation results have shown that multiple coasting points could exist satisfying both of the two constraints. After figuring out consumed energies according to the multiple coasting points, an optimal train speed profile with a coasting point giving the smallest consumed energy has been selected. Simulation blocks for the train performance simulation and GA have been designed with the Simulink.