This book introduces, in an accessible way, the basic elements of Numerical PDE-Constrained Optimization, from the derivation of optimality conditions to the design of solution algorithms. Numerical optimization methods in function-spaces and their application to PDE-constrained problems are carefully presented. The developed results are illustrated with several examples, including linear and nonlinear ones. In addition, MATLAB codes, for representative problems, are included. Furthermore, recent results in the emerging field of nonsmooth numerical PDE constrained optimization are also covered. The book provides an overview on the derivation of optimality conditions and on some solution algorithms for problems involving bound constraints, state-constraints, sparse cost functionals and variational inequality constraints.