Buy whole crabs live, cooked or frozen. Crab meat picked off the shell can also be purchased fresh or frozen. Obviously live is best as the is no greater guarantee of freshness. If that's offputting or you're frightened of being attacked by the large claws, make sure you get the crab from a reputable fishmonger and find out when it came into the shop. Look out for cracked, damaged shells and smell them to check against any unpleasant odours.
Crab meat should be eaten very soon after purchase as they are extremely perishable. Store on ice and eat within 24 hours.
Tips & Tricks:
If you are cooking with crab you must always use an uncooked crab. (Crab meat can never be cooked twice.) The new RSPCA guidelines on how to kill live crabs state that they should be chilled in a refrigerator or freezer for a couple of hours and then killed by splitting or spiking to destroy the nerve centres. At least at your hand, you know it died painlessly. From a culinary point of view it will taste better too.
There's nothing nicer than cooked crabmeat as it is. Boil the crab in salted water for 8 minutes per 500g. Leave to cool in the water for 10 minutes before draining and running under cold water. Refrigerate before serving.