The invention discloses an indoor positioning algorithm capable of combining inertial navigation with terrestrial magnetism on the basis of credibility. The algorithm comprises the following steps that: in a positioning initial stage, selecting a coordinate original point in a positioning area, establishing a coordinate system, and dividing the area according to different paths; through inertial navigation, obtaining the position coordinate of each step, obtaining standard terrestrial magnetism information on each coordinate point, and establishing an inertial navigation terrestrial magnetismfingerprint library; in a positioning process, according to an initial position point, obtaining a walking coordinate, and through a path matching algorithm, obtaining inertial navigation informationsource credibility and path similarity; according to the path similarity, carrying out clustering to obtain a local area terrestrial magnetism fingerprint library; applying an improved particle filtering algorithm to obtain terrestrial magnetism matching similarity, obtaining the coordinate point with the highest similarity, carrying out secondary matching with the local area terrestrial magnetismfingerprint library to obtain terrestrial magnetism information source credibility; and carrying out adaptive weighting algorithm combination on the terrestrial magnetism information source and the inertial navigation information source to obtain the point with the highest credibility, wherein the point with the highest credibility is an estimated position. By use of the algorithm, positioning accuracy and speed can be improved, and convenient, quick and accurate positioning service is provided for common users.