Position-estimation systems for indoor localization play an important role in everyday life. The global positioning system (GPS) is a popular positioning system, which is mainly efficient for outdoor environments. In indoor scenarios, GPS signal reception is weak. Therefore, achieving good position estimation accuracy is a challenge. To overcome this challenge, it is necessary to utilize other positionestimation systems for indoor localization. However, other existing indoor localization systems, especially based on inertial measurement unit (IMU) sensor data, still face challenges such as accumulated errors from sensors and external magnetic field effects. This paper proposes a position-estimation algorithm that uses the combined features of the accelerometer, magnetometer, and gyroscope data from an IMU sensor for position estimation. In this paper, we first estimate the pitch and roll values based on a fusion of accelerometer and gyroscope sensor values. The estimated pitch values are used for step detection. The step lengths are estimated by using the pitching amplitude. The heading of the pedestrian is estimated by the fusion of magnetometer and gyroscope sensor values. Finally, the position is estimated based on the step length and heading information. The proposed pitch-based step detection algorithm achieves 2.5% error as compared with acceleration-based step detection approaches. The heading estimation proposed in this paper achieves a mean heading error of 4.72 • as compared with the azimuth-and magnetometer-based approaches. The experimental results show that the proposed position-estimation algorithm achieves a high position accuracy that significantly outperforms that of conventional estimation methods used for validation in this paper. INDEX TERMS Indoor positioning system (IPS), pedestrian dead reckoning (PDR), heading estimation, indoor navigation, Android-based smartphone, quaternion, Kalman filter, sensor fusion.