Method for calibrating a magnetic sensor for determining a position of a encoder magnet along a path, the sensor having at least three similar sensor elements (20, 20-1, 20-2, 20-3) along the path, which can each detect the magnetic field of the encoder magnet at their location, and the sensor having evaluation electronics, the method comprising the steps: a) arranging the sensor elements (20-1, 20-2, 20-3) along the path at an equidistant distance, b) moving the encoder magnet along the path, c) sensing a component of the magnetic field by the sensor elements (20-1, 20-2, 20-3) and generating a sensor element signal (40-1, 40-2, 40-3) from each sensor element (20-1, 20-2, 20-3) in time-equidistant steps (tx) dependent on the position of the encoder magnet and storing the sensor element signals (40-1, 40-2, 40-3), d) wherein the respective signal waveforms (40-1, 40-2 and 40-3) have an approximately linear range in a partial range and this range is used as a measuring range and wherein the sensor elements (20-1, 20-2, 20-3) are arranged in such a way that adjacent measuring ranges adjoin one another in such a way that when the measured position reaches the end of such a quasi-linear range, then the quasi-linear range of the adjacent Hall sensor begins, e) detecting time-signal-value pairs in the measuring ranges during the movement of the encoder magnet by storing the times (tx) at which the respective sensor element signal (40-1, 40-2 or 40-3) is detected and storing the sensor element signal (Ux) associated with the respective time (tx), f) determining whether the encoder magnet is moved past the sensor elements (20-1, 20-2, 20-3) at a constant velocity, g) and in the presence of a constant velocity, determining which encoder magnet positions between each two adjacent sensor elements (20-1 and 20-2; 20-2 and 20-3) correspond to the points in time (tx), h) approximating a polynomial to the sensor element signal (40-1, 40-2, 40-3) of each sensor element (20-1, 20-2, 20-3) in the measurement ranges by determining polynomial coefficients in a calibration stroke of the permanent magnet from the pairs of values and the respective associated encoder magnet positions determined according to step g). a) arranging the sensor elements (20-1, 20-2, 20-3) along the path at an equidistant distance, b) moving the encoder magnet along the path, c) sensing a component of the magnetic field by the sensor elements (20-1, 20-2, 20-3) and generating a sensor element signal (40-1, 40-2, 40-3) from each sensor element (20-1, 20-2, 20-3) in time-equidistant steps (tx) dependent on the position of the encoder magnet and storing the sensor element signals (40-1, 40-2, 40-3), d) wherein the respective signal waveforms (40-1, 40-2 and 40-3) have an approximately linear range in a partial range and this range is used as a measuring range and wherein the sensor elements (20-1, 20-2, 20-3) are arranged in such a way that adjacent measuring ranges adjoin one another in such a way that when the measured position reaches the end of such a quasi-linear range, then the quasi-linear range of the adjacent Hall sensor begins, e) detecting time-signal-value pairs in the measuring ranges during the movement of the encoder magnet by storing the times (tx) at which the respective sensor element signal (40-1, 40-2 or 40-3) is detected and storing the sensor element signal (Ux) associated with the respective time (tx), f) determining whether the encoder magnet is moved past the sensor elements (20-1, 20-2, 20-3) at a constant velocity, g) and in the presence of a constant velocity, determining which encoder magnet positions between each two adjacent sensor elements (20-1 and 20-2; 20-2 and 20-3) correspond to the points in time (tx), h) approximating a polynomial to the sensor element signal (40-1, 40-2, 40-3) of each sensor element (20-1, 20-2, 20-3) in the measurement ranges by determining polynomial coefficients in a calibration stroke of the permanent magnet from the pairs of values and the respective associated encoder magnet positions determined according to step g).