Efforts to fulfill the demand for multi-degree-of-freedom (DOF) and long-range position motion of the magnetic levitation stage (MLS) are constrained by the sensor structure and measurement methodology. This article presents a long-range 6-DOF absolute displacement sensor based on the coding principle. The sensor is composed of a 2-D sensor matrix, utilizing the magnet array of the MLS as the magnetic source for displacement measurement. The sensor structure is simplified and is not limited to long-range motion and displacement measurements of the MLS. The sensor uses the intrinsic magnetic field of the magnet array to achieve local displacement measurement. Based on the unique positions of the sensor rows and columns in the sensor matrix, an absolute position reference is constructed by coding the measurement area to achieve long-range global absolute measurement. Using the local displacements of the magnet array and the reference position of the code areas in which it is located, a method for calculating the 6-DOF absolute displacements is proposed. Finally, a sensor prototype is fabricated and an experimental setup is built to evaluate its measurement performance. The results show that the proposed sensor can simultaneously achieve absolute displacement measurement in 6-DOF and long-range modes. Its translational displacement resolution is 1 mu m in the x- and y-directions and 2.5 mu m in the z-direction. The rotational angle resolution is 12.6'' in the Rx- and Ry-directions and 14.4'' in the Rz-direction. Additionally, the prototype sensor shows good measurement repeatability and enables stable displacement measurement of the MLS.