Evolution has invented the crab more than once, from different starting points
Crabs are not one family tree. The crab shape, with a flat armoured shell, the tail tucked under the body and a knack for scuttling sideways, has arisen independently in several lines of decapod crustaceans, a process called carcinisation. King crabs, for instance, are closer kin to hermit crabs than to true crabs.
Most crabs belong to the Brachyura, the so-called true crabs, which number around 7,000 species and wear a thick exoskeleton of heavily mineralised chitin; males often carry bigger claws than females. Several groups within the related Anomura, including porcelain, mole and king crabs, reached a similar look on their own. Biologists call such an assembly polyphyletic. Horseshoe crabs are something else entirely: they belong with spiders and scorpions and date back to the late Ordovician, around 445 million years ago.
Sizes range from the pea crab, a few millimetres across, to the Japanese spider crab, whose legs can span 4 metres. On land, the coconut crab holds the record among living invertebrates at up to 40 centimetres long and 4.1 kilograms. Hermit crabs never grew a full shell of their own, borrowing empty snail shells to shield their soft bodies instead.
Diets vary as widely. Plenty of crabs are marine omnivores eating algae, small animals and debris, but the mottled crab grazes mostly on algae, the yellow moon crab hunts, and porcelain crabs comb plankton from the water with feathery bristles. The tiny oyster crab lives inside an oyster's shell and steals its food. About 1,300 species across eight families have moved into fresh water, and Christmas Island red crabs march to the sea every year to lay eggs.
People catch or farm a lot of them: crabs are about a fifth of the marine crustaceans taken for food, eaten dressed in Britain and curried in Goa and Mozambique. They also star in Greek and Malay myths and the star sign Cancer, and a popular internet joke claims everything will eventually turn into a crab, an exaggeration of a real trend among decapods.
Source: Crab