The object of the invention relates to an encoder for a rotary position sensor, including a multipolar magnetic ring driven into rotation around its axis, and provided at its circumference with magnetic poles of a given sign, alternately positioned with magnetic poles of an opposite sign, so as to form at least one series of pairs of magnetic poles with a determined period, each magnetic pole of a given sign having a width Ii and a magnetic polarisation value Mi whereas each magnetic pole of opposite sign has a width Ii+1 different from width Ii and a magnetic polarisation value Mi+1, characterized in that the polarization of the magnetic poles is such that Mi×Ii=Mi+1×Ii+1.