Abstract Indoor pedestrian altitude information plays a key role in such applications as emergency relief and military reconnaissance. However, height errors of inertial positioning grow without boundary because of the altitude channel divergence of the Strap-down Inertial Navigation System (SINS). This article proposes a new vertical location method based on the foot-mounted Inertial Measurement Unit (IMU) and online floor modeling. First, the number of stairs at each step is calculated after the height of each step is corrected by the error compensation model. Second, the prior height is estimated by utilizing the number of stairs and the stair height. Then, the key point library related to the floor is built online. Finally, the error correction of the vertical displacement is carried out by matching the prior height with the key point library. The gait classification shows that the accuracy based on the error compensation model can reach up to 99%. Moreover, the maximum attitude error is less than 1 m and the accumulated vertical positioning errors are eliminated completely when a pedestrian walks up and down inside a multi-story building, and all these have verified accuracy and robustness of vertical indoor positioning.