This paper describes a novel commutation strategy for planar actuators with moving magnets and integrated magnetic bearing. The algorithm decouples the force and torque components directly and determines the current set-points of the coils by minimizing the ohmic losses. The algorithm can switch actively between different sets of coils and, consequently, the stroke of the actuator in the xy-plane is infinitely large. Furthermore, the technique is linked to the well known DQ0-transformation. The algorithm has been successfully tested on a magnetically levitated 6-DOF planar actuator with moving magnets