A walking bipedal robot’s energy efficiency depends on its gait as well as its design, whereas design changes affect the optimal gaits. We propose a method to take these interdependencies into account via simultaneous optimization of gait as well as design parameters. The method is applied to a planar robot with hybrid zero dynamics control and a torsion spring between its thighs. Periodic gaits are simulated by means of the hybrid zero dynamics. The implementation of the simultaneous optimization of gait parameters and spring stiffness via sequential quadratic programming is presented. Subsequently, an error analysis is performed to gain good convergence and short computation times of the optimization. The evaluation of gradients is identified as crucial for the algorithm’s convergence and therefore performed via complex step derivative approximations. The resulting implementation exhibits good convergence behavior and is provided as supplement to this paper. At 2.3 m/s, the simultaneous optimization results in savings in energy expenditure of up to 55%. A consecutive optimization of first gait and then stiffness yields only 11%, d ... mehremonstrating the advantage of the presented method.