It's easy to confuse a hermit crab that is molting with one that's dead. A crab in the midst of the molting process often comes partly out of its shell and can appear limp and immobile. When in doubt, it's best to assume the crab is molting, taking careful steps to ascertain whether it is alive or not.
Observe the crab carefully
Watch for small twitches on the part of the crab. Any movement at all indicates that the crab is still alive.
Do not disturb a molting crab
Protect a molting crab from other aquarium creatures. Don't disturb the crab yourself, as doing so during the molting process can be dangerous for the crab. Instead, surround the crab with a protective barrier so other aquarium creatures cannot reach it.
Check for a rotting smell
Sweep the sand at the bottom of the aquarium if a crab has buried itself, and check to see if the crab smells fishy. A dead crab starts to smell bad after a few days, while a molting crab has no unusual smell.