Over the last few days, a video of hermit crabs stampeding across the rocky shores of St. John in the U.S. Virgin Islands has taken the internet by storm. Where are the hermit crabs going, and why?

These hermit crabs are Coenobita clypeatus, the Caribbean hermit crab (also known as the soldier crab), which are native to islands throughout the Caribbean region. I typically think of hermit crabs as a marine phenomenon, but the adults of this species live in wet inland areas, hiding between tree roots or in caves. They mostly eat iguana poop (from Cyclura stejnegeri), although they can also climb up tree trunks to snack on soft wood.

And every summer, thousands of these hermit crabs migrate from the woods to the sea to release their eggs.

The hermit crabs begin creeping along the forest floor towards the shore in July or early August to meet up with others of their kind. On the way, they mate by partially removing their bodies from their shells, allowing the males to drop off their sperm packets. Then each female lays thousands of fertilized eggs and carries them around for about a month as they grow larger and deplete their yolky energy stores -- and the crabs continue their trek, sometimes navigating distances over 3 miles (5 kilometers).

Signaled by the crescent moon at the end of August or early September, the female crabs wade into the water. Upon contact with the salt water, the eggs burst and the larvae float into the waves. Over the course of three or four days, they "wash" their eggs in the water to make sure each gets touched by seawater. And then, all together, the hermit crabs make their way across the land back to the forest – the migration filmed in the video.

It's not known whether the females make this journey alone or if the males join them. "In some [Coenobita] species it's just the females that migrate, and they release their zoea larvae into the ocean when they get there," invertebrate zoologist Jan Pechenik of Tufts University wrote in an email. "But in some species both males and females migrate to the sea," mating along the way.

Hermit crab sex aside, the crabs in the video are either creeping towards the sea to release their larvae as zooplankton, or moving back home to snack on iguana poop until the following summer.

Reference: Nieves-Rivera, AM and EH Williams, Jr. 2003. Annual migrations and spawning of Coenobita clypeatus (Herbst) on Mona Island (Puerto Rico) and notes on inland crustaceans. Crustaceana, 75 (5): 547-558.