The intention of this textbook is to provide both, the theoretical and computational tools that are necessary to investigate and to solve optimal control problems with ordinary differential equations and differential-algebraic equations. An emphasis is placed on the interplay between the continuous optimal control problem, which typically is defined and analyzed in a Banach space setting, and discrete optimal control problems, which are obtained by discretization and lead to finite dimensional optimization problems