How to obtain accurate heading under multiple motion modes of pedestrians is the key difficulty in realizing the dead reckoning technology. Aiming at the problem of inconsistency between the solved heading and the actual direction of pedestrians after switching between different modes, a PDR heading elasticity compensation algorithm based on modal identification is proposed, which corrects the instantaneous heading through fixed heading declination and elastic heading declination to satisfy the navigation needs of cell phones under different usage modes. The experimental results show that the average head angle error of this algorithm is 2.65°, and the average localization error is 1.59m, which has a better heading error constraint effect.