Crabs, like these red rock crabs, often engage in a premating hug in which the male will wrap his claws and legs around the female.

Crabs can be found in all of the world's oceans and throughout the fresh water systems on land. Despite the crustaceans' apparent success, you'd think their odd body shape and rigid shells would make mating physically difficult. So just how do crabs do it?

In order to grow and increase their size, crabs must first molt, or shed their exoskeleton. And it is only during this molting period — when the new shell hasn't yet hardened — that most aquatic crab species mate, said Pamela Jensen, a biologist with the National Oceanic and Atmospheric Administration.

In this spring breeding season, adult crabs typically attract one another using pheromones (chemical scents). In some species, such as the blue crab (Callinectes sapidus), males will release pheromones and then use their claws to fan the scents toward prospective females, sometimes while moving side to side. In other species, including the Dungeness crab (Cancer magister), females release pheromones to draw in roaming males.

After making a chemical connection, the pair will engage in a premating embrace, where the male will wrap his claws and legs around the female. In some species, the female will go into this position willingly; in others, the male must prove himself through the hug. "Once she's convinced he's strong enough, she'll stop struggling," Jensen told LiveScience.

The embrace can last several days, after which point the female will molt and the pair will mate. The male transfers sperm by inserting his gonopods (sexual organs resembling antennae) into the two genital pores, called gonophores, on the female's underside. The female stores the sperm in a storage sac called a spermatheca until she is ready to use it.

Some crabs will mate standing up, facing one another, but most species actually prefer the missionary position, with the female beneath the male. Once copulation is complete, the male will guard the female for a few days (giving her shell time to harden) before taking off in search of a new mate.

Follow LiveScience @livescience, Facebook & Google+.