Scientists who have observed and studied cardinalfish — a tiny species that inhabits shallow marine habitats, such as coral reefs — know that even when its larvae are dispersed over a distance of several miles, most of them find their way back home. What they have struggled to understand is how.

Until now.

A study published in the latest edition of the journal Current Biology revealed the larvae of these fingernail-sized fish have an internal magnetic compass that directs them home even when there are no sun or stars to guide them.

“This study is the first clear demonstration that reef fish larvae possess magnetic senses to orient them at night,” study co-author Michael Kingsford from the ARC Centre of Excellence for Coral Reef Studies at James Cook University in Queensland, Australia, said in a statement. “Up until now, we only knew adult birds, marine mammals, sharks and boney fish have this in-built sense of direction.”

Baby Cardinal fish have an in-built magnetic 'compass' to guide them home. Andreas Bally

For their study, the researchers gathered larval specimen of Ostorhinchus doederleini — Doederlein’s cardinalfish — from the One Tree Island on the Great Barrier Reef. In order to test if an internal compass was responsible for their exceptional navigational skills, the authors of the study used a device that allowed them change to direction of a magnetic field surrounding the tank the larvae were floating in.

“Normally, fish orientated to the southeast, but when we altered the magnetic field clockwise by 120 degrees, there was a significant change in the direction the fish swam. They all turned further west, thinking they were still on track to their destination,” Kingsford said. “Our results show that larvae can use their magnetic senses to point them in the right direction when it’s night time.”

The scientists believe findings of the study may help them perfect the techniques needed to protect and maintain fish stocks in and around coral reefs.

“The study tells us these baby fish actually have brains,” Kingsford said. “They know where they are going and are strong swimmers. As a result they have some control over the reef they end up on. It’s not just about being led by the currents.”