Crustaceans are a diverse group of mostly aquatic animals found all over the globe, from shallow seas, to tide pools, to the abyssal depths of the deep oceans. Crustaceans, such as crabs and shrimp, are relatively low on the food chain and are often preyed upon by fish, sea mammals, mollusks (including octopi), and humans. As a result of this, crustaceans have developed several ways to protect themselves from potential predators.
Most crustaceans have hard exoskeletons. Known as the carapace, these are essentially the animals body armor, keeping hungry predators from biting down on it. The carapace protects all of the animal's vital organs and in some cases must be cracked before it can be eaten (some exceptions include krill and shrimp, which are typically eaten with their exoskeletons). However, in order to grow, the carapace must be frequently shed and regrown in a process known as moulting. During a moult, the crustacean may be very vulnerable to attacks.
Most crabs and lobsters come with a set of large pincers that can help them defend against predators. Lobsters have very powerful claws capable of severely damaging any attacking animal, including a human being, which is why you often see the claws banded shut in restaurants. They also use their claws and pincers for eating, often digging up food items in the sand or tearing chunks of meat off any detritus (dead animals) they may come across.
The common hermit crab employs a very famous technique for defending itself. Though it has very strong pincers like other crustaceans, it has a very soft body, so it takes refuge in empty shells. Any shell big enough for the crab to inhabit it moves into, including snail shells and conch shells. The shell provides a shelter, and the crab will carry it along its journey, swapping it for a bigger shell whenever it grows.
Many crustaceans use camouflage to hide from predators. Some, like mud crabs, have shells that often match the color of the surrounding sand and mud. They will bury themselves in the muck, hiding from potential predators. Crabs that live on coral reefs are often very brightly colored, blending in seamlessly with the surrounding, colorful corals.
If all else fails, crustaceans will simply flee. Crabs can use their six legs to scurry away from predators very quickly and hide among rocks or under mud. Shrimp propel themselves through the water by convulsing their bodies and moving their tails, allowing them to move quite rapidly away from predators. Many swimming shrimp are often known for traveling in large numbers, reducing the chances of a single shrimp being singled out and eaten.