A device for determining the magnitude and the direction of a relative displacement of two objects, comprising on the one hand an elongate scale which is provided on the first object and which extends in the direction of displacement, which scale consists of a plurality of alternating magnetic north and south poles, and on the other hand a measuring head which is provided on the second object and which comprises at least first and second, electrically unconnected, magnetic field sensors which are arranged with respect to the scale so that under the influence of the passage of the alternating north poles and south poles due to the relative displacement they are exposed to a magnetic field which alternates as a function of time and which causes an output signal in each of the sensors, the output signals of the two sensors varying in substantially the same way as a function of time but being phase-shifted with respect to one another, characterized in that the first and second magnetic field sensors are arranged so that they are always situated opposite the same point on the scale, the first sensor being sensitive mainly to variations in the component of the magnetic field which extends parallel to the longitudinal direction of the scale, the second sensor being sensitive mainly to variations in the component of the magnetic field which extends perpendicularly to the longitudinal direction of the scale and parallel to the connecting line between the scale and the measuring head.