A novel gait planning method using geodesics for humanoid robot is given in this paper. Both the linear inverted pendulum model and the exact Single Support Phase (SSP) are studied in our energy optimal gait planning based on geodesics. The kinetic energy of a 2-dimension linear inverted pendulum is obtained at first. We regard the kinetic energy as the Riemannian metric and the geodesic on this metric is studied and this is the shortest line between two points on the Riemannian surface. This geodesic is the optimal kinetic energy gait for the COG because the kinetic energy along geodesic is invariant according to the geometric property of geodesics and the walking is smooth and energy saving. Then the walking in Single Support Phase is studied and the energy optimal gait for the swing leg is obtained using our geodesics method. Finally, experiments using state-of-the-art method and using our geodesics optimization method are carried out respectively and the corresponding currents of the joint motors are recorded. With the currents comparing results, the feasibility of this new gait planning method is verified.