Multi-axis magnetic and accelerometer sensor are widely used in consumer product such as smart phones. The vector output of multi-axis sensors have errors on each axis such as offset error, scale error, non-orthogonality. These errors cause many problems on the performance of the applications. In this paper, we designed the effective inline compensation algorithm for calibrating of 3 axis sensors using ellipsoid for mass production of multi-axis sensors. The outputs with those kinds of errors can be modeled by ellipsoid, and the proposed algorithm makes sequential mappings of the virtual ellipsoid to perfect sphere which is calibrated function of the sensor on three-dimensional space. The proposed calibrating process composed of four main stages and is very straightforward and effective. In addition, another imperfection of the sensor such as the drift from temperature can be easily inserted in each mapping stage. Numerical simulation and experimental results shows great performance of the proposed compensation algorithm.