This paper presents a magnetic gravity compensator which is able to provide compensation around two axis of rotation for mobile arm support systems. Because of the compensation around two axes it provides more flexibility than the existing mechanical gravity compensators. This flexibility is achieved by using two semispherical permanent magnets, where the inner semisphere can rotate around the x, y and, z axis with respect to the outer semisphere. Several magnetization topologies, evaluated using 2D finite element analysis, are investigated and the most suitable topology is optimized in 2D finite element analysis. The optimization results are verified with 3D finite element analysis