CasADi is an open-source tool for nonlinear optimization and algorithmic differentiation. It facilitates rapid, yet efficient, implementation of different methods for numerical optimal control, both in an offline context and for nonlinear model predictive control (NMPC).