Railway is an efficient transportation system which is rapid, high-capacity and energy-efficient. It is also necessary to set up a timetable together with other plans beforehand due to its complexity. In practice timetables typically take passenger demand and locomotive properties into consideration but not energy consumption. On the other hand, most related works in the literature focus on minimizing energy consumption of a single train. This study proposes a method to optimize the total energy consumption by adjusting a given timetable while preserving the original order of the trains. The model first uses a multi-objective shortest path problem to derive the energy-time curve of trains, and then establishes numerically the relationship between energy consumption and running time with linear regression based on these energy-time curves. Finally, a linear program adjusts the given timetable to minimize total energy consumption, and seek for a balance between additional operation time and reduced energy consumption. Testing with a real-life example derived from the Taiwan Railways Administration timetable demonstrated the ability of the model to reduce energy consumption by slightly increasing the trains' running times.