A method to create a highly homogeneous magnetic field by applying topology optimized, additively manufactured passive shimming elements is investigated. The topology optimization algorithm can calculate a suitable permanent and nonlinear soft magnetic design that fulfills the desired field properties. The permanent magnetic particles are bonded in a polyamide matrix and they are manufactured with a low-cost, end-user 3D printer. Stray field measurements and an inverse stray field simulation framework can determine printing and magnetization errors. The customized shimming elements are manufactured by a selective melting process which produces completely dense soft magnetic metal parts. The methodology is demonstrated on a simple example of...