Weak and strong form shape hessians and their automatic generation. By analyzing variational problems formulated in the Unified Form Language, a structure-aware differentiation tool is presented which can automatically generate both the classical boundary representation and the weak or “volume” formulation of first and second order shape derivatives. Where applicable, the tool can either automatically apply the divergence theorem in tangent spaces for the strong form or calculate discrete material derivatives for the weak form. Furthermore, additional assumptions and simplifications can also be automatically applied, such that a repeated application leads to symmetric shape Hessians. The resulting expression can then be processed by the FEniCS environment, resulting in the semiautomatic creation of shape optimization chains from a user-supplied Lagrangian only. The methodology is tested by conducting shape Newton optimization using examples from geometry and CFD. The respective software is released as open source, available from url{https://bitbucket.org/Epoxid/femorph}.