It is generally accepted that crabs can be dead up to two hours before cooking and still be safe to eat. After two hours, the quality of the meat will begin to decline, so it is best to cook them as soon after they die as possible.