© 2022, The Author(s), under exclusive licence to Springer-Verlag GmbH Germany, part of Springer Nature.Wireless capsule endoscopies are being developed for gastrointestinal tract examination via magnetic tracking technology. These capsules make it possible to examine the patient’s digestive system without pain and easily diagnose diseases. However, one of the most important problems of these capsules is localization. This localization information includes 3-dimensional position and 3-dimensional orientation data from a set of magnetic sensors. These data must be obtained with the smallest error values. In recent years, metaheuristic algorithms have become popular in many fields due to their flexible nature. In this paper, the performances of frequently used algorithms such as artificial bee colony (ABC), differential evolution (DE), particle swarm optimization (PSO), teaching-learning based optimization (TLBO), genetic algorithm (GA), gravitational search algorithm (GSA), and whale optimization algorithm (WOA) are compared for magnetic localization problems. In addition, hybrid models combined with the Levenberg-Marquardt (LM) algorithm have been developed to increase their performance. In particular, while the PSO+LM algorithm is more successful than other algorithms, an adaptive version of this algorithm has been proposed to improve its performance further. Using the proposed version, the errors in the PSO+LM algorithm are further reduced and thus the localization efficiency of the capsules is increased.