https://www.scq.ubc.ca/the-compasses-of-birds/
One theory posits that certain birds’ brains contain magnetite, otherwise known as iron oxide[3]. Magnetite is a naturally occurring magnetic compound that has been found in animals ranging from bacteria to mammals[4]. With physical magnets in their brains, birds would be able to detect the magnetic fields created by the North and South Poles. Magnetite has been found in the upper beaks of several birds, but until recently, there has been little evidence that the substance is connected with navigation[5].
https://ssec.si.edu/stemvisions-blog/how-do-birds-navigate
Magnetite is a magnetized rock, which may act as a tiny GPS unit for the homing pigeon by giving it information about its position relative to Earth’s poles. Researchers have also found some specialized cells in birds’ eyes that may help them see magnetic fields.
It is thought that birds can use both the beak magnetite and the eye sensors to travel long distances over areas that do not have many landmarks, such as the ocean.