Cannibalism in hermit crabs is not a normal or healthy behavior.
By nature hermit crabs are omnivorous and eat all sorts of dead and decaying things they find on the beach. Their job is that of beach cleaner and they play an important role in their environment. They are scavengers, not predators.
In captive hermit crabs we often hear stories of one crab attacking another crab and killing it. In most cases this simply isn’t true. If you didn’t witness the attack that killed one of the crabs you can’t assume it was murdered by another crab. In most of these situations the more likely scenario is that one crab died and the other crab does what comes natural, began eating the carcass.
Hermit crabs simply do not possess a malevolent tendency. Instead you have to look to their survival instinct in driving this type of behavior. After all any species will do everything it can to survive.
The only instance when a live hermit crab may be attacked by another hermit crab is during molt but this can be avoided.
First, your substrate needs to be deep enough to allow 6 inches of substrate ABOVE your largest crab if it were to dig down to the bottom of your tank. This will mask that molting scent that draws other crabs.
Second, you must feed your hermit crabs a well balanced diet to make sure their nutritional needs are being met so they don’t feel forced to eat a molter to fill a nutritional need, usually a protein deficiency.
Third, when a molter surfaces and you notice other crabs hassling them, place all the crabs upside down in your water dishes. That should rinse off any residual molting scent. Please do not interpret this as a standard practice. Forcibly bathing your hermit crabs should be a last resort. If there is bullying happening with a newly surfaced molter, monitor the crabs to see if it stops on its own. If it does not stop or actually begins to escalate try this step.
Finally, don’t overcrowd your tank. Too many crabs in one tank is just asking for trouble.