In a rock pool, you sometimes see what seems to be a dead crab but is really light and there’s nothing inside. If fact, the owner left behind its protective covering, which is what you see, and has gone elsewhere to live another day.
Unlike hermit crabs, which have a relatively soft outer coating (exoskeleton) and so need to live inside the hard shells of dead molluscs, the usual crabs you see have hard protective cases. This causes problems as the crab grows and feels more and more squished in its rigid case.
So what happens in detail is this. The short version is that the crab dissolves its hard shell as it forms a new soft shell underneath, recycling the components of the original shell. Its body absorbs water, swells and the old shell splits apart. It backs out of its old shell and the body continues swelling up so the new soft shell hardens around the bigger body. It had better be in a safe space over the several hours to days this takes place, or it is easy pickings. The yellow organs below are for oxygen exchange.
We saw three discarded shells of the same species of crab, and whether that was coincidence or an indication of seasonal moulting, I don’t know.