A crab's habitat is the sand and the forest burrows depending on its species geographic range though pet crabs are often given sand, coral or Earth substrate for their habitat. Red crabs, blue crabs and horseshoe crabs live in the wild while hermit crabs can live in the wild or can be kept as pets.

The red crab likes to build burrows in forests so that they can avoid the humidity-sucking climate. The red crab will stay in its burrows for at least 2 months during the hottest weather seasons. The horseshoe crab also likes to burrow, but they tend to burrow in the sand. They also primarily burrow in order to lay their eggs. The horseshoe crab knows that if the eggs are buried then they are less likely to be found by predators.

The hermit crab will need a habitat that has sand, coral or Earth substrate as well as fake plants, branches or driftwood, rough rocks and shelters made from wood or plastic. It will also need to have shells set strategically in the habitat area because hermit crabs will shed their shells and climb into new shells as they grow. Discussing the hermit crab's habitat with a veterinarian will give owners the best chance at making a habitat that is supportive of the hermit crab's needs.